[PHP] $POST Q

2006-12-12 Thread William Stokes
Hello,

Can someone tell me what wrong or to how to manage this?

//default
$limitorig = 10;

echo select name=\USRlimitorig\;
echo option selected value=$limitorig/option;
echo option10/option;
echo option20/option;
echo option30/option;
echo input type=\submit\ name=\resetlimit\ value=\GO\;

When the form is first printed the selected default (10) value is shown OK 
and if something is selected everything is fine. If I just hit GO without 
changing the select menu the form fails because USRlimitorig will be empty. 
So how to post the $limitorig if user doesn't change it but hits GO 
anyway?

Thanks
-Will

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



Re: [PHP] $POST Q

2006-12-12 Thread clive

William Stokes wrote:

Hello,

Can someone tell me what wrong or to how to manage this?

//default
$limitorig = 10;

echo select name=\USRlimitorig\;
echo option selected value=$limitorig/option;
echo option10/option;
echo option20/option;
echo option30/option;
echo input type=\submit\ name=\resetlimit\ value=\GO\;


firstly its better to use option value='10' 10 /option

this might also solve your problem if I understand your question correctly.



When the form is first printed the selected default (10) value is shown OK 
and if something is selected everything is fine. If I just hit GO without 
changing the select menu the form fails because USRlimitorig will be empty. 
So how to post the $limitorig if user doesn't change it but hits GO 
anyway?


Thanks
-Will



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



[PHP] Automating PHP email

2006-12-12 Thread clr
I am creating a PHP/mySQL site that enables members to set criteria for 
email notification
As my site changes and clients criteria are met they need to be 
notified.

I can generate a list of email address and info quite simply using mySQL

My question is how to trigger or initiate this process as I am a bit 
weary of using cron


Can anyone suggest how I can automate this using PHP ?

Many thanks

Colin

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



Re: [PHP] Automating PHP email

2006-12-12 Thread Stut

clr wrote:
I am creating a PHP/mySQL site that enables members to set criteria 
for email notification

As my site changes and clients criteria are met they need to be notified.
I can generate a list of email address and info quite simply using mySQL

My question is how to trigger or initiate this process as I am a bit 
weary of using cron


Can anyone suggest how I can automate this using PHP ?


Face your fear use cron. You know it's the right thing to do.

-Stut

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



RE: [PHP] Automating PHP email

2006-12-12 Thread zoticaic
--
 My Seeding Blog | http://bytes.nullp0inter.com
 Hire me as Freelancer | http://www.getafreelancer.com/affiliates/shockx/

 -Original Message-
 From: clr [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, December 12, 2006 5:02 PM
 To: php-general@lists.php.net
 Subject: [PHP] Automating PHP email
 
 I am creating a PHP/mySQL site that enables members to set criteria for
 email notification
 As my site changes and clients criteria are met they need to be
 notified.
 I can generate a list of email address and info quite simply using mySQL
 
 My question is how to trigger or initiate this process as I am a bit
 weary of using cron
 
 Can anyone suggest how I can automate this using PHP ?
 
 Many thanks
 
 Colin

Colin,

First, you need to established when and what triggers this actions.

As for the solution I would usually go through these steps : 

- Create a shell PHP script to execute the emailing routine. Such script would
maintain a log of when it was last executed and some other status info, this can
be through a text file of MySQL database. This script can also be used with cron
if you desire or decide to switched back to a more reliable solution :)
- On another script (one that is always called whena user request a page on your
site i.e. global.php). On this script checks the status of the shell script from
its logs, it will determine if IT'S TIME TO RUN THE SCRIPT AGAIN.

This is my oldschool solution :D . I'd still love to hear other's.

Regards,
Jervin

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



[PHP] filedownload and output buffering

2006-12-12 Thread viraj

hi all,
i have a small script which shows some information inside a html table
and then pushes a file to save on to users desktop.

but with the following code it download the file and stay without
outputting the html table to browser.

i tried with out put buffering functions, but still no luck (it seems
i'm not clear about those functions yet..). could somebody please help
me on this?

many thanks


~viraj



?php

function my_callback($content) {
   header('Content-type: application/binary; charset=iso-8859-1');
   header(Expires: 0);
   header(Cache-Control: must-revalidate, post-check=0,pre-check=0);
   header(Pragma: public);
header(Content-Disposition: attachment; filename=\Test.url\);
$content .= [InternetShortcut]\r\n .
 URL=http://192.168.1.71/\r\n; .
 IDList= .
 IconFile=http://192.168.1.71/favicon.ico\r\n; .
 IconIndex=1\r\n .
[{000214A0---C000-0046}]\r\n .
Prop3=19,2\r\n;

   return $content;
}


ob_start('my_callback');
getBody();
ob_end_flush();

function getBody()
{
   ?
html
head
   meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /
/head
body
   table cellspacing=0 cellpadding=0 width=780 align=center
border=1
   tbody
   tr
   td class=outerBorder valign=top width=780Some
information goes here../td
   /tr
   /tbody
   /table
/body
/html
   ?php
}

?

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



Re: [PHP] Problems with Zip+IE6

2006-12-12 Thread Javier Ruiz

damn! that's a pretty good article, thanks a lot.

unfortunatelly, it's not mentioning about zip files concretely, I didn't
find a solution for my problem with them.
I tried playing a bit with the Content-type, but it seems that Internet
Explorer doesn't really care about Content-type... it uses the extention
of the file to determine the type (microsoft's way...) so it doesn't matter
if I use application/octet-stream or even application/force-download or
application/makethisdownload-or-ikillyou :-D as long as I name the file 
whatever.zip, IE6 shows the open with dialog and if I use open with an
application, it fails :(

thanks again Richard for the answer and for the article :)

anybody with a miracle for the ZIP+IE problem??



On 12/5/06, Richard Lynch [EMAIL PROTECTED] wrote:


It's kinda long, but this will probably save you some grief:
http://richardlynch.blogspot.com

On Tue, December 5, 2006 2:07 am, Javier Ruiz wrote:
 Hi all!

 I have a problem with zip files and Internet Explorer 6. I try to send
 to
 the user a dinamically generated zip file writting the http headers
 and
 using file_put_contents for the zip content. It works fine when
 downloading
 the file with firefox, opera, etc... even it works well if I download
 the
 file with internet explorer and then open it with any zip tool. The
 problem
 comes when I try to directly open the file from the URL using IE6.

 I found this is a known bug of IE (several versions) in windows XP:
 http://support.microsoft.com/kb/308090

 Does anybody know any way to workaround this problem? I found a couple
 workarounds in forums over there and I tried them, but unfortunately
 they
 didn't work:
1 - To change the mimetype (when writting http headers) from
 application/zip that I used before to application/x-zip-compressed
2 - To not use MOD_DEFLATE in apache2 (I was not using it
 really...)



 Any idea??

 Thanks a lot!



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




Re: [PHP] file uploads Q?

2006-12-12 Thread Jochem Maas
Børge Holen wrote:
 On Monday 11 December 2006 20:48, Jochem Maas wrote:
 Richard Lynch wrote:
 On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
 Is it possible to allow  user pick several images and upload them all
 at
 once? (I need to pass the images to a function for the resize). Or do
 I need
 to give several browse buttons to allow multiple file uploads?
 Yes, you would need to have several INPUT TYPE=FILE browse buttons.

 Also I have seen a application (written with MS tools) that allows
 user to
 upload a zip file containing images and the zip is automatically
 uncompressed to a server disk. Can this be done with PHP also?
 Yes.
 http://php.net/zip
 the zip extension is only available in php5.2 (or installable via
 pecl).

 another option would to use the exec() function to make a call to
 gunzip in order to unpack the contents of the zip file.

 a truely poorman's alternative would be to offer multiple FILE input
 fields on the relevant page and check which one's are not empty when
 the submission occurs.
 
 there is no reason for checking each input.

is that crack your smoking?

 Take a look at my earlier questions with the subject A general UL script 
 and 
 the replies with various ppl here 'bout the use of $_FILES.
 This way it will check anything listed in the file(s) input of form(s).

er, whatever. whose next?

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



Re: [PHP] $POST Q

2006-12-12 Thread Jochem Maas
William Stokes wrote:
 Hello,
 
 Can someone tell me what wrong or to how to manage this?
 
 //default
 $limitorig = 10;
 
 echo select name=\USRlimitorig\;
 echo option selected value=$limitorig/option;

  ^^ what do you think $_POST['USRlimitorig'] will 
be if you select the first option?

 echo option10/option;
 echo option20/option;
 echo option30/option;
 echo input type=\submit\ name=\resetlimit\ value=\GO\;
 
 When the form is first printed the selected default (10) value is shown OK 
 and if something is selected everything is fine. If I just hit GO without 
 changing the select menu the form fails because USRlimitorig will be empty. 
 So how to post the $limitorig if user doesn't change it but hits GO 
 anyway?
 
 Thanks
 -Will
 

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



[PHP] PHP 4 on Apache 1.3

2006-12-12 Thread zoticaic
Hello,

 

I've been trying for a couple of times now but seems to not find the solution as
to why this error occurs.

 

I have Apache 1.3.37 installed on a Fresh CentOS 4.4 machine with this configure
line : ./configure -enable-module=so -enable-module=rewrite

 

I tried building PHP 4.4.4 using ./configure -with-mysql
-with-apxs=/usr/local/apache/bin/apxs but kept getting this error : 

 

Sorry, I cannot run apxs.  Possible reasons follow:

 

1. Perl is not installed

2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs

3. Apache was not built using --enable-so (the apxs usage page is displayed)

 

The output of apxs follows:

./configure: line 5656: apxs: command not found

configure: error: Aborting

 

--

1. I have verified that Perl is installed perl -v 

2. /usr/local/apache/bin/apxs does exists

3. I have configured apache to enable the so module.

 

Am I missing something?

 

TIA

Jervin

--
 Outsource Now | GetAFreelancer
http://www.getafreelancer.com/affiliates/shockx/ 

 



RE: [PHP] PHP 4 on Apache 1.3

2006-12-12 Thread Edward Kay
A couple of suggestions:

* The options should start with a double minus, i.e. --with-mysql
not -with-mysql
* Are the permissions OK for axps and it's directory?

Edward


 Hello,



 I've been trying for a couple of times now but seems to not find
 the solution as
 to why this error occurs.



 I have Apache 1.3.37 installed on a Fresh CentOS 4.4 machine with
 this configure
 line : ./configure -enable-module=so -enable-module=rewrite



 I tried building PHP 4.4.4 using ./configure -with-mysql
 -with-apxs=/usr/local/apache/bin/apxs but kept getting this error :



 Sorry, I cannot run apxs.  Possible reasons follow:



 1. Perl is not installed

 2. apxs was not found. Try to pass the path using
 --with-apxs2=/path/to/apxs

 3. Apache was not built using --enable-so (the apxs usage page is
 displayed)



 The output of apxs follows:

 ./configure: line 5656: apxs: command not found

 configure: error: Aborting



 --

 1. I have verified that Perl is installed perl -v

 2. /usr/local/apache/bin/apxs does exists

 3. I have configured apache to enable the so module.



 Am I missing something?



 TIA

 Jervin

 --
  Outsource Now | GetAFreelancer
 http://www.getafreelancer.com/affiliates/shockx/






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



RE: [PHP] Need help with RegEx

2006-12-12 Thread Ford, Mike
On 11 December 2006 19:43, Michael wrote:

 At 08:29 AM 12/11/2006 , Brad Fuller wrote:
  
  The example provided didn't work for me.  It gave me the same
  string without anything modified.
 
 You are absolutely correct, this is what I get for not
 testing it explicitly :( My most sincere apologies to the OP
 and the list, there is an error in my example (see below for
 correction) 
 
  I have cut and pasted from further down in the quoted
 message, for convenience 
   Using the tags you describe here, and assuming the source html is
   in the variable $source_html, try this:
   
   $trans_text = preg_replace(/(.*?)(div id=result_box
   dir=ltr)(.*?)(\/div)(.*?)^/s,$3,$source_html);
 
 The End of string symbol ^ should not be included.

That's because ^ is not the end-of-string symbol -- it's the START-of-string 
symbol.  $ is the END-of string symbol.  But the OP doesn't need either of 
these symbols as he's not trying to match at the start or end of the string, 
and nor does he need your suggested leading and trailing (.*?) for the same 
reason.  Unless anchored with ^ and/or $, preg is perfectly happy to match in 
the middle of the subject string.

@Anthony: your pattern is fine -- it's what you're doing with it that's wrong.

On 11 December 2006 08:03, Anthony Papillion wrote:

 $trans_text = preg_match(\/div id=result_box
 dir=ltr(.+?)\/div/);
 
 The problem is that when I echo the value of $trans_text variable, I
 end up with the entire HTML of the page.

I don't see how this is possible, since preg_match returns an integer telling 
you how many times the pattern matched -- which will be 0 or 1, since 
preg_match doesn't do multiple matches!  You also clearly haven't given us your 
actual call, since you've only included the pattern and not the subject string.

What you're after is the third argument to preg_match, which returns an array 
of matched text; so for:

preg_match(/div id=result_box dir=ltr(.+?)\\/div/, $orig, $matches);

$matches[0]  will return the entire match (everything from div  to /div
$matches[1]  will return the first parenthesized expression, which is what 
you're looking for.

Note also the doubled backslash, since you need to pass a single backslash 
through to escape the / for preg_match.  As an alternative, I would strongly 
advise using a different delimiter, so that no escaping is needed; for instance:

preg_match(#div id=result_box dir=ltr(.+?)/div#, $orig, $matches);

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 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] Havn't been on the list in a while

2006-12-12 Thread clive

Jim Lucas wrote:

Seems like this list has slowed down alot.

Anybody else notice this, or am I just missing something?

jl



well it is almost the end of the year perhaps some people are on holiday 
 already?


clive

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



RE: [PHP] file uploads Q?

2006-12-12 Thread Tim

 Børge Holen wrote:
  On Monday 11 December 2006 20:48, Jochem Maas wrote:
  Richard Lynch wrote:
  On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
  Is it possible to allow  user pick several images and upload them all
  at
  once? (I need to pass the images to a function for the resize). Or do
  I need
  to give several browse buttons to allow multiple file uploads?
  Yes, you would need to have several INPUT TYPE=FILE browse buttons.
 
  Also I have seen a application (written with MS tools) that allows
  user to
  upload a zip file containing images and the zip is automatically
  uncompressed to a server disk. Can this be done with PHP also?
  Yes.
  http://php.net/zip
  the zip extension is only available in php5.2 (or installable via
  pecl).
 
  another option would to use the exec() function to make a call to
  gunzip in order to unpack the contents of the zip file.
 
  a truely poorman's alternative would be to offer multiple FILE input
  fields on the relevant page and check which one's are not empty when
  the submission occurs.
 
  there is no reason for checking each input.
 
 is that crack your smoking?


Well considering you are using multiple FILE input fields, when you post the
form all file info is stored in $_FILE array.. So weather or not the user
added a file to the a certain field is irrelevant. For example:

input name=userfile[] type=file size=10 --- filled
input name=userfile[] type=file size=10 
input name=userfile[] type=file size=10 --- filled

You would then parse this with:

for ($i=0; $icount($_FILES['userfile']['name']); $i++) { 
 your code here
}

count($_FILES['userfile']['name']); would be two here 


if you want to make sure user has uploaded three files then just compare to
the count() value.. otherwise just parse the content..

So no I don't think he's on crack mate :)

  Take a look at my earlier questions with the subject A general UL
 script and
  the replies with various ppl here 'bout the use of $_FILES.
  This way it will check anything listed in the file(s) input of form(s).
 
 er, whatever. whose next?
 

Some people generate large amounts of irrelevant crap traffic for nothing
imo :)

Tim

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Børge Holen
On Tuesday 12 December 2006 12:01, you wrote:
 Børge Holen wrote:
  On Monday 11 December 2006 20:48, Jochem Maas wrote:
  Richard Lynch wrote:
  On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
  Is it possible to allow  user pick several images and upload them all
  at
  once? (I need to pass the images to a function for the resize). Or do
  I need
  to give several browse buttons to allow multiple file uploads?
 
  Yes, you would need to have several INPUT TYPE=FILE browse buttons.
 
  Also I have seen a application (written with MS tools) that allows
  user to
  upload a zip file containing images and the zip is automatically
  uncompressed to a server disk. Can this be done with PHP also?
 
  Yes.
  http://php.net/zip
 
  the zip extension is only available in php5.2 (or installable via
  pecl).
 
  another option would to use the exec() function to make a call to
  gunzip in order to unpack the contents of the zip file.
 
  a truely poorman's alternative would be to offer multiple FILE input
  fields on the relevant page and check which one's are not empty when
  the submission occurs.
 
  there is no reason for checking each input.

 is that crack your smoking?

No, I LEARN from this list. 

you?




  Take a look at my earlier questions with the subject A general UL
  script and the replies with various ppl here 'bout the use of $_FILES.
  This way it will check anything listed in the file(s) input of form(s).

 er, whatever. whose next?

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Jochem Maas
Tim wrote:
 Børge Holen wrote:
 On Monday 11 December 2006 20:48, Jochem Maas wrote:
 Richard Lynch wrote:
 On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
 Is it possible to allow  user pick several images and upload them all
 at
 once? (I need to pass the images to a function for the resize). Or do
 I need
 to give several browse buttons to allow multiple file uploads?
 Yes, you would need to have several INPUT TYPE=FILE browse buttons.

 Also I have seen a application (written with MS tools) that allows
 user to
 upload a zip file containing images and the zip is automatically
 uncompressed to a server disk. Can this be done with PHP also?
 Yes.
 http://php.net/zip
 the zip extension is only available in php5.2 (or installable via
 pecl).

 another option would to use the exec() function to make a call to
 gunzip in order to unpack the contents of the zip file.

 a truely poorman's alternative would be to offer multiple FILE input
 fields on the relevant page and check which one's are not empty when
 the submission occurs.

 there is no reason for checking each input.

 is that crack your smoking?
 
 
 Well considering you are using multiple FILE input fields, when you post the
 form all file info is stored in $_FILE array.. So weather or not the user
 added a file to the a certain field is irrelevant. For example:
 
 input name=userfile[] type=file size=10 --- filled
 input name=userfile[] type=file size=10 
 input name=userfile[] type=file size=10 --- filled
 
 You would then parse this with:
 
 for ($i=0; $icount($_FILES['userfile']['name']); $i++) { 
  your code here
 }

nice, so basically what your saying is need to check each input.
if you have three file inputs - regardless of what you call them (using
the '[]' gives you a nice array structure to loop) you will have to check each
one to see whether it 'contains' a *valid* *uploaded* file (or whether the
user uploaded nothing in a given input, or whether an error occured with a
particular file, etc).

copy/pasting sombody else's file upload handler code doesn't constitute
'no reason to check each input' - it's simply handing off the input checking
onto code written by someone else.

 
 So no I don't think he's on crack mate :)

either way he's unlikely to be financing said crack habit with the proceeds
of paid php development.

 
 Take a look at my earlier questions with the subject A general UL
 script and
 the replies with various ppl here 'bout the use of $_FILES.
 This way it will check anything listed in the file(s) input of form(s).
 er, whatever. whose next?
  
 
 Some people generate large amounts of irrelevant crap traffic for nothing
 imo :)

I do my best. (there is a gag in there about 'irrelevant crack' but I'll let it 
pass
this time).

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



RE: [PHP] Need help with RegEx

2006-12-12 Thread Michael
At 04:56 AM 12/12/2006 , Ford, Mike wrote:
On 11 December 2006 19:43, Michael wrote:

 At 08:29 AM 12/11/2006 , Brad Fuller wrote:
  
  The example provided didn't work for me.  It gave me the same
  string without anything modified.
 
 You are absolutely correct, this is what I get for not
 testing it explicitly :( My most sincere apologies to the OP
 and the list, there is an error in my example (see below for
 correction) 
 
  I have cut and pasted from further down in the quoted
 message, for convenience 
   Using the tags you describe here, and assuming the source html is
   in the variable $source_html, try this:
   
   $trans_text = preg_replace(/(.*?)(div id=result_box
   dir=ltr)(.*?)(\/div)(.*?)^/s,$3,$source_html);
 
 The End of string symbol ^ should not be included.

That's because ^ is not the end-of-string symbol -- it's the START-of-string 
symbol.  $ is the END-of string symbol.  But the OP doesn't need either of 
these symbols as he's not trying to match at the start or end of the string, 
and nor does he need your suggested leading and trailing (.*?) for the same 
reason.  Unless anchored with ^ and/or $, preg is perfectly happy to match in 
the middle of the subject string.

Well, DOH, leave it to me to bugger something up like that heh, got the $ and ^ 
reversed. Thanks for correcting me :) 



@Anthony: your pattern is fine -- it's what you're doing with it that's wrong.

On 11 December 2006 08:03, Anthony Papillion wrote:

 $trans_text = preg_match(\/div id=result_box
 dir=ltr(.+?)\/div/);
 
 The problem is that when I echo the value of $trans_text variable, I
 end up with the entire HTML of the page.

I don't see how this is possible, since preg_match returns an integer telling 
you how many times the pattern matched -- which will be 0 or 1, since 
preg_match doesn't do multiple matches!  You also clearly haven't given us 
your actual call, since you've only included the pattern and not the subject 
string.

What you're after is the third argument to preg_match, which returns an array 
of matched text; so for:

preg_match(/div id=result_box dir=ltr(.+?)\\/div/, $orig, $matches);

$matches[0]  will return the entire match (everything from div  to /div
$matches[1]  will return the first parenthesized expression, which is what 
you're looking for.

Note also the doubled backslash, since you need to pass a single backslash 
through to escape the / for preg_match.  As an alternative, I would strongly 
advise using a different delimiter, so that no escaping is needed; for 
instance:

preg_match(#div id=result_box dir=ltr(.+?)/div#, $orig, $matches);

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 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Jochem Maas
Børge Holen wrote:
 On Tuesday 12 December 2006 12:01, you wrote:
 Børge Holen wrote:
 On Monday 11 December 2006 20:48, Jochem Maas wrote:
 Richard Lynch wrote:

...

 is that crack your smoking?
 
 No, I LEARN from this list. 
 
 you?

we'll I'll admit to learning plenty on this list from 'old wise' ones like
the ubiquitous mr Lynch. but as far as your concerned I TEACH on this list.

TEACHER: are you smoking crack?
STUDENT: no, I learn from this list!
TEACHER: what you think you're learning through your crack haze is not
what we are teaching.

some time passes

STUDENT: f*** ***, (*^# [EMAIL PROTECTED] #$)Q !)*#%^ [EMAIL PROTECTED] 
@[EMAIL PROTECTED] %#

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Børge Holen
On Tuesday 12 December 2006 14:10, Jochem Maas wrote:
 Tim wrote:
  Børge Holen wrote:
  On Monday 11 December 2006 20:48, Jochem Maas wrote:
  Richard Lynch wrote:
  On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
  Is it possible to allow  user pick several images and upload them
  all at
  once? (I need to pass the images to a function for the resize). Or
  do I need
  to give several browse buttons to allow multiple file uploads?
 
  Yes, you would need to have several INPUT TYPE=FILE browse buttons.
 
  Also I have seen a application (written with MS tools) that allows
  user to
  upload a zip file containing images and the zip is automatically
  uncompressed to a server disk. Can this be done with PHP also?
 
  Yes.
  http://php.net/zip
 
  the zip extension is only available in php5.2 (or installable via
  pecl).
 
  another option would to use the exec() function to make a call to
  gunzip in order to unpack the contents of the zip file.
 
  a truely poorman's alternative would be to offer multiple FILE input
  fields on the relevant page and check which one's are not empty when
  the submission occurs.
 
  there is no reason for checking each input.
 
  is that crack your smoking?
 
  Well considering you are using multiple FILE input fields, when you post
  the form all file info is stored in $_FILE array.. So weather or not the
  user added a file to the a certain field is irrelevant. For example:
 
  input name=userfile[] type=file size=10 --- filled
  input name=userfile[] type=file size=10
  input name=userfile[] type=file size=10 --- filled
 
  You would then parse this with:
 
  for ($i=0; $icount($_FILES['userfile']['name']); $i++) {
   your code here
  }

 nice, so basically what your saying is need to check each input.
 if you have three file inputs - regardless of what you call them (using
 the '[]' gives you a nice array structure to loop) you will have to check
 each one to see whether it 'contains' a *valid* *uploaded* file (or whether
 the user uploaded nothing in a given input, or whether an error occured
 with a particular file, etc).

 copy/pasting sombody else's file upload handler code doesn't constitute
 'no reason to check each input' - it's simply handing off the input
 checking onto code written by someone else

It is sad to see that you got an amazing tool like this list and still manages 
to read and understand it the way you FEEL like at any moment.


  So no I don't think he's on crack mate :)

 either way he's unlikely to be financing said crack habit with the proceeds
 of paid php development.

  Take a look at my earlier questions with the subject A general UL
 
  script and
 
  the replies with various ppl here 'bout the use of $_FILES.
  This way it will check anything listed in the file(s) input of form(s).
 
  er, whatever. whose next?
 
  Some people generate large amounts of irrelevant crap traffic for nothing
  imo :)

 I do my best. (there is a gag in there about 'irrelevant crack' but I'll
 let it pass this time).

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

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



RE: [PHP] file uploads Q?

2006-12-12 Thread Tim


 -Message d'origine-
 De : Jochem Maas [mailto:[EMAIL PROTECTED]
 Envoyé : mardi 12 décembre 2006 14:10
 À : Tim
 Cc : php-general@lists.php.net
 Objet : Re: [PHP] file uploads Q?
 
 Tim wrote:
  Børge Holen wrote:
  On Monday 11 December 2006 20:48, Jochem Maas wrote:
  Richard Lynch wrote:
  On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
  Is it possible to allow  user pick several images and upload them
 all
  at
  once? (I need to pass the images to a function for the resize). Or
 do
  I need
  to give several browse buttons to allow multiple file uploads?
  Yes, you would need to have several INPUT TYPE=FILE browse
 buttons.
 
  Also I have seen a application (written with MS tools) that allows
  user to
  upload a zip file containing images and the zip is automatically
  uncompressed to a server disk. Can this be done with PHP also?
  Yes.
  http://php.net/zip
  the zip extension is only available in php5.2 (or installable via
  pecl).
 
  another option would to use the exec() function to make a call to
  gunzip in order to unpack the contents of the zip file.
 
  a truely poorman's alternative would be to offer multiple FILE input
  fields on the relevant page and check which one's are not empty when
  the submission occurs.
 
  there is no reason for checking each input.
 
  is that crack your smoking?
 
 
  Well considering you are using multiple FILE input fields, when you post
 the
  form all file info is stored in $_FILE array.. So weather or not the
 user
  added a file to the a certain field is irrelevant. For example:
 
  input name=userfile[] type=file size=10 --- filled
  input name=userfile[] type=file size=10
  input name=userfile[] type=file size=10 --- filled
 
  You would then parse this with:
 
  for ($i=0; $icount($_FILES['userfile']['name']); $i++) {
   your code here
  }
 
 nice, so basically what your saying is need to check each input.
 if you have three file inputs - regardless of what you call them (using
 the '[]' gives you a nice array structure to loop) you will have to check
 each
 one to see whether it 'contains' a *valid* *uploaded* file (or whether the
 user uploaded nothing in a given input, or whether an error occured with a
 particular file, etc).
 
 copy/pasting sombody else's file upload handler code doesn't constitute
 'no reason to check each input' - it's simply handing off the input
 checking
 onto code written by someone else.
 
Ermm ok, if you say so, thats a standard validation loop i made using info
from php.net, so yes i did copy/paste.. MY code.. 

I never said you don't need to check each file.. 
Isn't it standard to validate each file against certain parameters?
I validate each input as each file uploaded (images) are set to be displayed
in a certain fashion on the main page based on weather it is number 0 (main
image) number 0 are secondary images that require smaller thumbnails.
Secondly my clients want the files displayed in a certain order rather then
randomly getting files from a certain directory. I add the file position
($i) in the database for correct display order.

All depends on the context of which you want to display the files later on..

That’s just my way of parsing it there are many others.. Mine works, its
fast, and requires little code rather then bulking my site with costly java
applets.

 
  So no I don't think he's on crack mate :)
 
 either way he's unlikely to be financing said crack habit with the
 proceeds
 of paid php development.

I just made a remark on this, because i believe debate on a certain fashion
of coding is valid on this list, comments like yours which have nothing to
do with coding and are just a personal opinion maybe expressing your
frustration with life are not what I look for on this list. Wasting my time
opening a message with these types of remarks is not what I am looking for
either. Furthermore these kinds of comments degrade the quality of these
lists. And I don't think I am alone in believing this.

Regards,
Tim

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



Re: [PHP] flash/php file uploader

2006-12-12 Thread Emil Edeholt

Hi

Thanks for your answer, but I use an ajax solution right now and that is 
what I want to replace. I would really like to avoid flash, but I can't 
get this solution to work properly. Atleast my solution has been a 
little buggy in Safari (works mostly, but sometimes it won't upload the 
file) and I think sometimes in Firefox too, haven't tested it enough in 
Explorer to be sure if the bug is there too.


But formerly the upload speed has been extreeemly slow compared to a 
flash solution or a normal form file upload. I've based my work on 
http://tomas.epineer.se/archives/3 do you know if that is a good 
implementation?


I could send you some of my source, if you want/have time to take a 
quick look? (would really like to know if my code is bad, or if it's the 
browsers support for ajax file upload that are buggy/slow).


Mustafa Aras Koktas wrote:

Hello

Flash is not the best solution for this.
Either patch PHP with an unofficial patch for accessing raw data content
length which is available on the manual page of file uploads in php.net
or use perl to access raw data.

I use a combination of  the following

1. post data to perl
2. perl file gets the data length and id of the file, saves it to a
temporary file
3. on post submit an ajax application posts to a php file with the same id
4. php file checks the length of the temporary file with the corresponding
id number
5. php file writes the size, and some fancy graphs to screen
6. ajax sets timeout every 3 seconds to update status
7. perl file forwards the saved data to a php file, so that it can make
necessary operations on the raw data.

It works fine this way.

--Aras
  

--

Hälsningar Emil Edeholt

Karlsson  Novak Medical AB
Telefon 090-154830
Mobil 070-3758222
E-post [EMAIL PROTECTED]

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Stut

Børge Holen wrote:
No, I LEARN from this list. 


you?


I smoke this list. Keeps me happy, out of trouble, and best of all it's 
free!


-Stut

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Jochem Maas
Børge Holen wrote:

...

 It is sad to see that you got an amazing tool like this list and still 
 manages 
 to read and understand it the way you FEEL like at any moment.
 

what makes this list 'amazing' is the handful of people who regularly answer
(even the most banal) questions.

the interpretation is the perogative of the reader - if you feel you are
being misunderstood your only recourse is to write more clearly, moaning about
how other people 'feel like reading  understanding' what you write is futile
and childish.

AFAIC rather than hiding your derision behind some politically correct 'sadness'
(which you either imply to be some kind of fact and/or an opinion shared by 
some unnamed
group - whereas I hazard to guess that neither is even close to the truth) just 
come out
and say what *you* mean.

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Stut

Jochem Maas wrote:

and say what *you* mean.


I LIKE MARMITE!!

Damn, that does feel better.

-Stut
(fairly bored today)

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Jochem Maas
Stut wrote:
 Jochem Maas wrote:
 and say what *you* mean.
 
 I LIKE MARMITE!!

you have my condolences.

 
 Damn, that does feel better.

see, just let it out... (said in soothing psychoanalyst's voice)

 
 -Stut
 (fairly bored today)

really!? ;-)

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



[PHP] Advice needed: implementing custom fields in tables

2006-12-12 Thread Denis Gerasimov
Hello list members,

 

I am in a need of implementing custom/used-defined fields mechanism. What I
need is adding new fileds to a db table on-the-fly.

 

There are 2 possible options I know:

1.   Add a fixed set of text columns named custom_01, custom_02, etc.

2.   Alter db tables dynamically by adding/dropping a column of
appropriate type and creating/dropping helper tables if needed (e.g. values
for select lists)

 

1st option is not suitable for in my case because of performance issues.

2nd is relatively hard to implement from scratch.

 

Any ready-to-use libs or implementation ideas would be highly appreciated!

 

FYI I am using Joomla! CMS and actually I need to create a Joomla! component
that should also support user-defined fields.

 

Have a great day,

 

Denis S Gerasimov 
Web Developer
Team Force LLC

Web:http://www.team-force.org/ www.team-force.org

RU  Int'l:   +7 8362-213555

email:[EMAIL PROTECTED]

 



Re: [PHP] Advice needed: implementing custom fields in tables

2006-12-12 Thread Jochem Maas
Denis Gerasimov wrote:
 Hello list members,
 
  
 
 I am in a need of implementing custom/used-defined fields mechanism. What I
 need is adding new fileds to a db table on-the-fly.
 
  
 
 There are 2 possible options I know:
 
 1.   Add a fixed set of text columns named custom_01, custom_02, etc.
 
 2.   Alter db tables dynamically by adding/dropping a column of
 appropriate type and creating/dropping helper tables if needed (e.g. values
 for select lists)
 
  
 
 1st option is not suitable for in my case because of performance issues.

1 is a horrid solution but I can't see how this is such a performance issue.
(not to say the issue does'nt exist, it's just that I don't see it)

 
 2nd is relatively hard to implement from scratch.

I would suggest this is easier than you imagine (you can grok all the required 
SQL
from the output of phpmyadmin, for instance) - the tricky part is getting the
database security right (which is more PITA than hard imho)

 Any ready-to-use libs or implementation ideas would be highly appreciated!
 

3. offer an interface to define the custom fields, store the definition 
somewhere central
and use the definition to define an array (or object) which you can then 
serialize into a single
field.

4. use a 'lookup' table and a 'custom field definition' table

'lookup':

ownerid int // FK to whatever entity owns the custom fields
CFD_id  int // FK to 'custom field definition'
value   varchar 

'custom field definition':
id  int
namevarchar
typevarchar

you might want to create a set of lookup tables (1 for each *type* of custom 
data
you are offering the enduser) - this may offer more efficient storage and 
retrieval.



anything that is ready to use can be found via your favorite search engine, or 
sourceforge
or something like that.

 
 FYI I am using Joomla! CMS and actually I need to create a Joomla! component
 that should also support user-defined fields.

you mean to say joomla doesn't have a plugin for this at all??

 
  
 
 Have a great day,

too late, my Jean-Luc Picard has already been assimilated.

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



Re: [PHP] file uploads Q?

2006-12-12 Thread David Giragosian

On 12/12/06, Jochem Maas [EMAIL PROTECTED] wrote:


Stut wrote:
 Jochem Maas wrote:
 and say what *you* mean.

 I LIKE MARMITE!!

you have my condolences.


 Damn, that does feel better.

see, just let it out... (said in soothing psychoanalyst's voice)


 -Stut
 (fairly bored today)

really!? ;-)

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



And someone wonders why the traffic on this site has slowed to a crawl...?
If I wanted to be misunderstood, I'd talk with my wife.

David


[PHP] Download adds ^M to beginning of file

2006-12-12 Thread lists

Hi,

Using the below code to force download works fine on most servers and 
with most

browsers. However it does crash Firefox when I download a specific file, IE
works like beauty. File content starts with:

#!/sbin/_joor_perl_use Filter::decrypt..

This is the code to force the download:

header(Pragma: public);
header(Expires: 0);
header(Cache-Control: must-revalidate, post-check=0, pre-check=0);
header(Content-Type: application/octet-stream);
header(Content-Disposition: attachment; filename=\$file\);
header(Content-Transfer-Encoding: binary);
header(Content-Length: $size);
$file = fopen($completePath, 'r');

while(ob_get_level()) {
ob_end_flush();
}

while(!feof($file)) {
echo fread($file, 2048);
}

fclose($file);

Where can I start? Could it be server config? Or could it have to do 
with flush?

If I remove the ob_end_flush() it does not crash Firefox.

Best regards,
Peter Lauri

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



[PHP] Newline Before XML Document

2006-12-12 Thread Ray Hauge
I've read a lot of information about this error (in Firefox):

 

XML Parsing Error: xml declaration not at start of external entity

 

Basically it means that the XML did not start at the beginning of the
file.  The weird part of this is that if I save the document to a file
on the webroot and then view it that way, the XML is displayed
correctly.

 

So far I've tried using output buffering to make sure no other
information was sent before I output the XML, but that didn't work.
I've also tried replacing all return characters and newline characters,
but that also didn't work.

 

In Konqueror I get the following error message:

 

fatal parsing error: invalid name for processing instruction in line 2,
column 6

?xml version=1.0 encoding=utf-8?

 

I even tried the following on the ob_get_contents():

$xml_string = substr($xml_string, strstr($xml_string, ''));

 

Has anyone else run into this problem?  As far as I can tell this
document starts on line 1.

 

Thanks,

--

Ray Hauge

Application Development Lead

American Student Loan Services

www.americanstudentloan.com

 



Re: [PHP] Download adds ^M to beginning of file

2006-12-12 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
 Hi,



 
 Using the below code to force download works fine on most servers and
 with most
 browsers. However it does crash Firefox when I download a specific
 file, IE
 works like beauty. File content starts with:
 
 #!/sbin/_joor_perl_use Filter::decrypt..
 
 This is the code to force the download:
 
 header(Pragma: public);
 header(Expires: 0);
 header(Cache-Control: must-revalidate, post-check=0, pre-check=0);
 header(Content-Type: application/octet-stream);
 header(Content-Disposition: attachment; filename=\$file\);
 header(Content-Transfer-Encoding: binary);
 header(Content-Length: $size);
 $file = fopen($completePath, 'r');

// no need to fopen/fclose if you decide to use readfile()...

 
 while(ob_get_level()) {
 ob_end_flush();
 }

// this should be:
while(ob_get_level()) ob_end_clean(); // discard all output!

 
 while(!feof($file)) {
 echo fread($file, 2048);
 }
 
 fclose($file);

// and this could probably be better written as:
@readfile($file); // read the whole file directly to the output buffer

 
 Where can I start? Could it be server config? Or could it have to do
 with flush?

at a guess: yes.

 If I remove the ob_end_flush() it does not crash Firefox.
 
 Best regards,
 Peter Lauri
 

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



[PHP] Cookies page refresh

2006-12-12 Thread William Stokes
Hello,

I have a page that uses session cookies for deciding what content to show to 
a visitor. User also has 2 form objecks to apply filters to the content SQL 
queries. So at the beginning of the script I set 2 cookies based on user 
selections(or defaults) and after that make DB query based on user 
selections. I wanted to use cookies because there also back - up - 
forward links for pagination.

Problem is that in order to get the cookie based system to work the page 
needs a refresh to read the cookies and display content corretly. Is this 
because the page loads faster than the server set's the cookies to client 
browser? If so what's the corrert / best way to implement the filters and 
page navigation if there's 2 form select lists and 3 links to navigate the 
page.

Thanks
-Will

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



[PHP] Retransmiting post variables

2006-12-12 Thread Fernando M. M.


Hello,

I have a script called redir.php that is used only for redirecting
using the following code:

header('Location: ', $_GET['url']);

But
now i need to redirect post varibles too. Example:

If someone access
redir.php?url=my_page.php and post:

a=1b=2

I need to
send this post string (as post) to my_page.php.

How can i do this?

Thanks.

-- 

Blog: http://blog.forumdebian.com.br/fernando
Contato: http://www.forumdebian.com.br/fernando/contato.php


Re: [PHP] problems configuring php5.2.0 and php4.4.4 with mysql5.0.27

2006-12-12 Thread Jochem Maas
sidenote: shouldn't Erik be using the mysqli extension (note the extra *i*)
instead of mysql?

http://php.net/mysqli (... The mysqli extension allows you to access the
functionality provided by MySQL 4.1 and above ...)


Richard Lynch wrote:
 Did you configure/install MySQL *and* the mysql-dev packages or
 whatever your OS needs for the MySQL headers to be there?
 
 Did you also compile MySQL and install it?
 
 Is there a libmysqlclient somewhere like /usr/local/lib or /usr/lib or
 whatever is appropriate for your system?
 
 On Linux, did you do that 'ldconfig' thing that tells the OS to scan
 for new libraries in various dirs?
 
 On Linux, is the dir where your libmysqlclient lives listed in
 /etc/ld.so.conf so that the OS can find it when you do the ldconfig
 thing?
 
 ldconfig -v | grep mysql is your buddy on Linux for this one.
 
 Not that I've ever stumbled through this problem before, oh no.
 :-) :-) :-)
 
 It's weird how quickly this stuff becomes second nature after you
 screw it up a half-dozen times...
 
 On Sat, December 9, 2006 4:37 am, Erik Nordlander wrote:
 Hi, im having troubles configuring php5.2.0 (since this version didnt
 work i
 also tried 4.4.4 without success) with mysql 5.0.27 and apache 2.2.3.
 The
 apache server is working properly, and so does the mysql server.

 Theres a unexpeced error in the configwindow;

 checking return type of qsort... void
 checking for mysql_close in -lmysqlclient... no
 checking for mysql_error in -lmysqlclient... no
 configure: error: mysql configure failed. Please check config.log for
 more
 information.

 when i execute with command:

 ../configure --with-apxs2=/usr/local/apache2/bin/apxs
 --with-mysql=/usr/local/mysql
 --with-zlib-dir=/home/erikn/php5/pph-5.2.0/ext/zlib
 --with-gd

 the configlog is attached to this document, if you need it :)

 thanks in advance!
 Erik Nordlander
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Børge Holen
On Tuesday 12 December 2006 15:02, Jochem Maas wrote:
 Børge Holen wrote:

 ...

  It is sad to see that you got an amazing tool like this list and still
  manages to read and understand it the way you FEEL like at any moment.

 what makes this list 'amazing' is the handful of people who regularly
 answer (even the most banal) questions.

 the interpretation is the perogative of the reader - if you feel you are
 being misunderstood your only recourse is to write more clearly, moaning
 about how other people 'feel like reading  understanding' what you write
 is futile and childish.

 AFAIC rather than hiding your derision behind some politically correct
 'sadness' (which you either imply to be some kind of fact and/or an opinion
 shared by some unnamed group - whereas I hazard to guess that neither is
 even close to the truth) just come out and say what *you* mean.

LOL, Yes yes, I agree with a lot of what you are saying, more or less bs.
but then again; you are a complete moron. go relieve yerself, that would 
probably help. 

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



RE: [PHP] Newline Before XML Document

2006-12-12 Thread Ray Hauge
I found the problem.

I was re-writing the page from using the old DOMXML to the new DOM.  We
recently switched to PHP5, and there's only one script (so far) that
creates XML, so it was easier to just use the domxml-php4-to-php5.php
class that is available online.  I didn't realize that there was an
extra line after the closing '?' in that file.  That was causing the
extra invisible line to show up.

--
Ray Hauge
Application Development Lead
American Student Loan Services
www.americanstudentloan.com

-Original Message-
From: Ray Hauge 
Sent: Tuesday, December 12, 2006 9:14 AM
To: php-general@lists.php.net
Subject: [PHP] Newline Before XML Document

I've read a lot of information about this error (in Firefox):

 

XML Parsing Error: xml declaration not at start of external entity

 

Basically it means that the XML did not start at the beginning of the
file.  The weird part of this is that if I save the document to a file
on the webroot and then view it that way, the XML is displayed
correctly.

 

So far I've tried using output buffering to make sure no other
information was sent before I output the XML, but that didn't work.
I've also tried replacing all return characters and newline characters,
but that also didn't work.

 

In Konqueror I get the following error message:

 

fatal parsing error: invalid name for processing instruction in line 2,
column 6

?xml version=1.0 encoding=utf-8?

 

I even tried the following on the ob_get_contents():

$xml_string = substr($xml_string, strstr($xml_string, ''));

 

Has anyone else run into this problem?  As far as I can tell this
document starts on line 1.

 

Thanks,

--

Ray Hauge

Application Development Lead

American Student Loan Services

www.americanstudentloan.com

 

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



[PHP] php redirection..

2006-12-12 Thread bruce
hi...

i have what should be a pretty simple question that i'm obviously missing
something for...

i want to be able to display some text/content and to then redirect the user
to another page.

basically:

cat.php
 -echo  test contentbr
 -echo  more test contentbr

//redirect user
 echo
  script
location.href='foo.php';
  /script
 ;

---
foo.php
 -echo i'm here


should be pretty simple...

however, in my test, without the script/location.href i display the content
ok. when i add the script/location.href, i get redirected, but the content
is never displayed...

any thoughts/samples/pointers on what might be going on, and how this should
really be accomplished..

to be honest, i'm embarrassed to even be raising this here!!

thanks.

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



Re: [PHP] Problems with Zip+IE6

2006-12-12 Thread Frank M. Kromann
Hello,

if you use:

header(Content-Type: application/zip);
header(Content-Disposition: attachment; filename=\somefile.zip\);

That works for me with IE 6/7 and other browsers.

- Frank

 damn! that's a pretty good article, thanks a lot.
 
 unfortunatelly, it's not mentioning about zip files concretely, I
didn't
 find a solution for my problem with them.
 I tried playing a bit with the Content-type, but it seems that Internet
 Explorer doesn't really care about Content-type... it uses the
extention
 of the file to determine the type (microsoft's way...) so it doesn't
matter
 if I use application/octet-stream or even application/force-download
or
 application/makethisdownload-or-ikillyou :-D as long as I name the
file 
 whatever.zip, IE6 shows the open with dialog and if I use open with
an
 application, it fails :(
 
 thanks again Richard for the answer and for the article :)
 
 anybody with a miracle for the ZIP+IE problem??
 
 
 
 On 12/5/06, Richard Lynch [EMAIL PROTECTED] wrote:
 
  It's kinda long, but this will probably save you some grief:
  http://richardlynch.blogspot.com
 
  On Tue, December 5, 2006 2:07 am, Javier Ruiz wrote:
   Hi all!
  
   I have a problem with zip files and Internet Explorer 6. I try to
send
   to
   the user a dinamically generated zip file writting the http headers
   and
   using file_put_contents for the zip content. It works fine when
   downloading
   the file with firefox, opera, etc... even it works well if I
download
   the
   file with internet explorer and then open it with any zip tool. The
   problem
   comes when I try to directly open the file from the URL using IE6.
  
   I found this is a known bug of IE (several versions) in windows XP:
   http://support.microsoft.com/kb/308090
  
   Does anybody know any way to workaround this problem? I found a
couple
   workarounds in forums over there and I tried them, but
unfortunately
   they
   didn't work:
  1 - To change the mimetype (when writting http headers) from
   application/zip that I used before to
application/x-zip-compressed
  2 - To not use MOD_DEFLATE in apache2 (I was not using it
   really...)
  
  
  
   Any idea??
  
   Thanks a lot!
  
 
 
  --
  Some people have a gift link here.
  Know what I want?
  I want you to buy a CD from some starving artist.
  http://cdbaby.com/browse/from/lynch
  Yeah, I get a buck. So?
 
 
 

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



Re: [PHP] php redirection..

2006-12-12 Thread Stut

bruce wrote:

i want to be able to display some text/content and to then redirect the user
to another page.

basically:

cat.php
 -echo  test contentbr
 -echo  more test contentbr

//redirect user
 echo
  script
location.href='foo.php';
  /script
 ;

---
foo.php
 -echo i'm here


should be pretty simple...

however, in my test, without the script/location.href i display the content
ok. when i add the script/location.href, i get redirected, but the content
is never displayed...

any thoughts/samples/pointers on what might be going on, and how this should
really be accomplished..

to be honest, i'm embarrassed to even be raising this here!!


And so you should be what with it being a Javascript question and this 
being a PHP list.


Anyhoo, I don't get your confusion. The browser will run the script as 
it loads it from your site. Ergo, it redirects before it displays what 
you have output. I suggest you Google for examples of the settimeout 
Javscript function - that's what you need to delay the redirect.


-Stut

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



Re: [PHP] php redirection..

2006-12-12 Thread Stut

bruce wrote:

hey stut...


Please don't reply to me directly, always include the mailing list.


thanks for the reply... i did get some output...

i also have a question as to why i couldn't get it to work when i used
'header (foo.php)'


1) The correct way to redirect using the header function is 
header('Location: http://domain.com/foo.php'); Note the absolute URL.

2) Using header will definitely not display any output from the page.


i did a 'ob_end_flush()' at the start, followed by a 'header()' at the end,
but the header didn't seem to function as i though it should.


I suggest you read about the header function in the manual 
(http://php.net/header) - you clearly don't have any idea what it does.



given that the ultimate information that i'm going to want to display will
be dynamic. some times it might be 5 lines, others 100, others 50...

i had hoped that i could somehow display the content, wait a few seconds,
and then do an auto redirect...


Like I said in my first reply, Google for the Javascript function 
settimeout - that's what you need.



any thoughts/comments...


I have lots of comments. Thoughts are less common but they do 
occasionally happen.


-Stut


-Original Message-
From: Stut [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 12, 2006 9:21 AM
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] php redirection..


bruce wrote:

i want to be able to display some text/content and to then redirect the

user

to another page.

basically:

cat.php
 -echo  test contentbr
 -echo  more test contentbr

//redirect user
 echo
  script
location.href='foo.php';
  /script
 ;

---
foo.php
 -echo i'm here


should be pretty simple...

however, in my test, without the script/location.href i display the

content

ok. when i add the script/location.href, i get redirected, but the content
is never displayed...

any thoughts/samples/pointers on what might be going on, and how this

should

really be accomplished..

to be honest, i'm embarrassed to even be raising this here!!


And so you should be what with it being a Javascript question and this
being a PHP list.

Anyhoo, I don't get your confusion. The browser will run the script as
it loads it from your site. Ergo, it redirects before it displays what
you have output. I suggest you Google for examples of the settimeout
Javscript function - that's what you need to delay the redirect.

-Stut

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



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



[PHP] inheritance php4

2006-12-12 Thread blackwater dev

Ok,

I have a class which inherits from a parent class.  My first thought is that
the child class inherits all of the functions of the parent but that doesn't
seem to be the case, do I really have to put parent::somefunction() to call
each one?  Why can't I just use $this-parentfunction(); within the child
class?

Thanks!


class Parent{

function getAddress(){}

}

class Child extends Parent{

   function getInfo(){

   $this-getAddress(); //throws error

}

}


[PHP] Re: inheritance php4

2006-12-12 Thread blackwater dev

nevermind, I was doing something stupid.

On 12/12/06, blackwater dev [EMAIL PROTECTED] wrote:


Ok,

I have a class which inherits from a parent class.  My first thought is
that the child class inherits all of the functions of the parent but that
doesn't seem to be the case, do I really have to put parent::somefunction()
to call each one?  Why can't I just use $this-parentfunction(); within the
child class?

Thanks!


class Parent{

 function getAddress(){}

}

class Child extends Parent{

function getInfo(){

$this-getAddress(); //throws error

}

}



RE: [PHP] inheritance php4

2006-12-12 Thread bruce
hi...

haven't used php classes.. so this might not pertain.. but do php classes
have the concept of public/private functions? are the parent functions that
you're trying to access public/private?



-Original Message-
From: blackwater dev [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 12, 2006 11:00 AM
To: php-general@lists.php.net
Subject: [PHP] inheritance php4


Ok,

I have a class which inherits from a parent class.  My first thought is that
the child class inherits all of the functions of the parent but that doesn't
seem to be the case, do I really have to put parent::somefunction() to call
each one?  Why can't I just use $this-parentfunction(); within the child
class?

Thanks!


class Parent{

 function getAddress(){}

}

class Child extends Parent{

function getInfo(){

$this-getAddress(); //throws error

}

}

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



Re: [PHP] inheritance php4

2006-12-12 Thread Brad Bonkoski

bruce wrote:

hi...

haven't used php classes.. so this might not pertain.. but do php classes
have the concept of public/private functions? 

Not in PHP 4

are the parent functions that
you're trying to access public/private?



-Original Message-
From: blackwater dev [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 12, 2006 11:00 AM
To: php-general@lists.php.net
Subject: [PHP] inheritance php4


Ok,

I have a class which inherits from a parent class.  My first thought is that
the child class inherits all of the functions of the parent but that doesn't
seem to be the case, do I really have to put parent::somefunction() to call
each one?  Why can't I just use $this-parentfunction(); within the child
class?

Thanks!


class Parent{

 function getAddress(){}

}

class Child extends Parent{

function getInfo(){

$this-getAddress(); //throws error

}

}

  


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



RE: [PHP] php redirection..

2006-12-12 Thread Tim
Just a quick question regarding this issue.

Considering bruce wants to be able to display the data and then change
location after a given time, and as stut said you can't do this with a
header() as it redirects before output, I would have imagined a dynamic meta
tag in the header with a time variable and a location variable.

But then I wonder what affect this has regards to html standards? 
Are dynamic meta tags depreciated?

Regards,
Tim

 -Message d'origine-
 De : Stut [mailto:[EMAIL PROTECTED]
 Envoyé : mardi 12 décembre 2006 19:52
 À : [EMAIL PROTECTED]
 Cc : php
 Objet : Re: [PHP] php redirection..
 
 bruce wrote:
  hey stut...
 
 Please don't reply to me directly, always include the mailing list.
 
  thanks for the reply... i did get some output...
 
  i also have a question as to why i couldn't get it to work when i used
  'header (foo.php)'
 
 1) The correct way to redirect using the header function is
 header('Location: http://domain.com/foo.php'); Note the absolute URL.
 2) Using header will definitely not display any output from the page.
 
  i did a 'ob_end_flush()' at the start, followed by a 'header()' at the
 end,
  but the header didn't seem to function as i though it should.
 
 I suggest you read about the header function in the manual
 (http://php.net/header) - you clearly don't have any idea what it does.
 
  given that the ultimate information that i'm going to want to display
 will
  be dynamic. some times it might be 5 lines, others 100, others 50...
 
  i had hoped that i could somehow display the content, wait a few
 seconds,
  and then do an auto redirect...
 
 Like I said in my first reply, Google for the Javascript function
 settimeout - that's what you need.
 
  any thoughts/comments...
 
 I have lots of comments. Thoughts are less common but they do
 occasionally happen.
 
 -Stut
 
  -Original Message-
  From: Stut [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, December 12, 2006 9:21 AM
  To: [EMAIL PROTECTED]
  Cc: php-general@lists.php.net
  Subject: Re: [PHP] php redirection..
 
 
  bruce wrote:
  i want to be able to display some text/content and to then redirect the
  user
  to another page.
 
  basically:
 
  cat.php
   -echo  test contentbr
   -echo  more test contentbr
 
  //redirect user
   echo
script
  location.href='foo.php';
/script
   ;
 
  ---
  foo.php
   -echo i'm here
 
 
  should be pretty simple...
 
  however, in my test, without the script/location.href i display the
  content
  ok. when i add the script/location.href, i get redirected, but the
 content
  is never displayed...
 
  any thoughts/samples/pointers on what might be going on, and how this
  should
  really be accomplished..
 
  to be honest, i'm embarrassed to even be raising this here!!
 
  And so you should be what with it being a Javascript question and this
  being a PHP list.
 
  Anyhoo, I don't get your confusion. The browser will run the script as
  it loads it from your site. Ergo, it redirects before it displays what
  you have output. I suggest you Google for examples of the settimeout
  Javscript function - that's what you need to delay the redirect.
 
  -Stut
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

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



RE: [PHP] php redirection..

2006-12-12 Thread Tim
Just a quick question regarding this issue.

Considering bruce wants to be able to display the data and then change
location after a given time, and as stut said you can't do this with a
header() as it redirects before output, I would have imagined a dynamic meta
tag in the header with a time variable and a location variable.

But then I wonder what affect this has regards to html standards? 
Are dynamic meta tags depreciated?

Regards,
Tim

 -Message d'origine-
 De : Stut [mailto:[EMAIL PROTECTED]
 Envoyé : mardi 12 décembre 2006 19:52
 À : [EMAIL PROTECTED]
 Cc : php
 Objet : Re: [PHP] php redirection..
 
 bruce wrote:
  hey stut...
 
 Please don't reply to me directly, always include the mailing list.
 
  thanks for the reply... i did get some output...
 
  i also have a question as to why i couldn't get it to work when i used
  'header (foo.php)'
 
 1) The correct way to redirect using the header function is
 header('Location: http://domain.com/foo.php'); Note the absolute URL.
 2) Using header will definitely not display any output from the page.
 
  i did a 'ob_end_flush()' at the start, followed by a 'header()' at the
 end,
  but the header didn't seem to function as i though it should.
 
 I suggest you read about the header function in the manual
 (http://php.net/header) - you clearly don't have any idea what it does.
 
  given that the ultimate information that i'm going to want to display
 will
  be dynamic. some times it might be 5 lines, others 100, others 50...
 
  i had hoped that i could somehow display the content, wait a few
 seconds,
  and then do an auto redirect...
 
 Like I said in my first reply, Google for the Javascript function
 settimeout - that's what you need.
 
  any thoughts/comments...
 
 I have lots of comments. Thoughts are less common but they do
 occasionally happen.
 
 -Stut
 
  -Original Message-
  From: Stut [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, December 12, 2006 9:21 AM
  To: [EMAIL PROTECTED]
  Cc: php-general@lists.php.net
  Subject: Re: [PHP] php redirection..
 
 
  bruce wrote:
  i want to be able to display some text/content and to then redirect the
  user
  to another page.
 
  basically:
 
  cat.php
   -echo  test contentbr
   -echo  more test contentbr
 
  //redirect user
   echo
script
  location.href='foo.php';
/script
   ;
 
  ---
  foo.php
   -echo i'm here
 
 
  should be pretty simple...
 
  however, in my test, without the script/location.href i display the
  content
  ok. when i add the script/location.href, i get redirected, but the
 content
  is never displayed...
 
  any thoughts/samples/pointers on what might be going on, and how this
  should
  really be accomplished..
 
  to be honest, i'm embarrassed to even be raising this here!!
 
  And so you should be what with it being a Javascript question and this
  being a PHP list.
 
  Anyhoo, I don't get your confusion. The browser will run the script as
  it loads it from your site. Ergo, it redirects before it displays what
  you have output. I suggest you Google for examples of the settimeout
  Javscript function - that's what you need to delay the redirect.
 
  -Stut
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

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



[PHP] Whitespace in Emails

2006-12-12 Thread jennifer
I'm experiencing a strange problem and difficult to diagnose because  
it's random. I have built an application that sends out an email with  
a nice amount of text (don't have exact char count, but could get it).


On the html email, a random whitespace appears in the content, but  
always toward the end pointing to a possible character count issue.


See below for examples of how the space wanders and is random:

1- Th ere are several things being discussed in this email.
2- There are se veral things being discussed in this email.
3- There are severa l things being discussed in this email.

This whitepace issue happens after the email is sent.

Anybody have any ideas?

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



[PHP] Varying session behavior between 2 nearly identical Apache/PHP setups

2006-12-12 Thread Matthew North

Hello All,

I have an odd situation that I wonder if someone might have some
insight on.  The scenario is this:

- Two FreeBSD systems running Apache+mod_php+others.  We use one for
development and the other for testing.

- Each system is running PHP 5.2.0 with identical php.ini files.

- On each system we have identical PHP code (confirmed to be identical
by comparing cksum output) that looks essentially like this:

=== snip ===
?php
.
. [page setup code]
.
trigger_error('['.session_id().']');
if (needSession  !session_id())
   session_start();
trigger_error('['.session_id().']');
.
. [page output code]
.
?
=== snip ===

Errors are logged to file rather than the page, so the trigger_error()
calls above result in entries similar to:

[08-Dec-2006 16:59:23] PHP Notice:  [] in /path/to/file.php on line 178

[08-Dec-2006 16:59:23] PHP Notice: [GmQidWwShpRpHCGDiQrBr-Lk4ib] in
/path/to/file.php on line 181

So it appears a session is started.

However, on the test system a session cookie is never sent back to the
browser so the session cannot be restored, while on the development
system everything works as it should (session cookie is set and
session is therefore restored on each page load).

Using 'wget -S', here are the response headers sent by the development system:

$ wget -S http://dev/ajax/shopping_list.php\?action=add\SKU=ABC
--15:48:41--  http://dev/ajax/shopping_list.php?action=addSKU=ABC
  = `shopping_list.php?action=addSKU=ABC.1'
Resolving dev... 192.168.0.30
Connecting to dev|192.168.0.30|:80... connected.
 HTTP/1.1 200 OK
 Date: Mon, 11 Dec 2006 23:48:41 GMT
 Server: Apache/2.2.3 (FreeBSD) mod_ssl/2.2.3 OpenSSL/0.9.7e-p1 DAV/2
PHP/5.2.0 with Suhosin-Patch mod_ruby/1.2.5 Ruby/1.8.5(2006-08-25) SVN/1.4.2
mod_jk/1.2.15
 X-Powered-By: PHP/5.2.0
 Set-Cookie: PHPSESSID=WJ33PpO,nphiPAVxrbrWrQEnO5a; path=/
 Expires: Thu, 19 Nov 1981 08:52:00 GMT
 Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
 Pragma: no-cache
 Content-Length: 103
 Keep-Alive: timeout=15, max=100
 Connection: Keep-Alive
 Content-Type: application/xml
Length: 103 [application/xml]


And on the live server:


$ wget -S http://test/ajax/shopping_list.php\?action=add\SKU=ABC
--15:48:26--  http://test/ajax/shopping_list.php?action=addSKU=ABC
  = `shopping_list.php?action=addSKU=ABC'
Resolving test... 192.168.0.31
Connecting to test|192.168.0.31|:80... connected.
HTTP request sent, awaiting response...
 HTTP/1.1 200 OK
 Date: Mon, 11 Dec 2006 23:48:26 GMT
 Server: Apache/2.0.59 (Unix) mod_ssl/2.0.59 OpenSSL/0.9.7e-p1 SVN/1.3.2
PHP/5.2.0 DAV/2
 X-Powered-By: PHP/5.2.0
 Content-Length: 103
 Keep-Alive: timeout=15, max=100
 Connection: Keep-Alive
 Content-Type: application/xml
Length: 103 [application/xml]


No session cookie!  Note that the bodies of these two responses are
identical as determined using diff.  Also note that we have other sets
of code on the test system which call session_start(), and a session
cookie _is_ set, as it should be, and everything works fine.  So it's
not simply that the session module is broken or mis-configured on the
test machine.  Under most circumstances sessions work fine on both
systems.  This implies that there is something specific about the code
that is running in the [page setup code] and/or [page output code]
(refer to snippet above) that is causing session_start() to behave
unusually.  But again, the PHP code is identical, so it must be the
code *in combination with* some other external difference between the
two systems.

The only differences between the two systems that could conceivably
make sense (to my mind) in terms of this differing behavior are:
Apache 2.0.59 and no Suhosin patch on the test machine, vs Apache
2.2.3 _with_ Suhosin patch on the development system (and I mention
Suhosin only because it makes some cookie-related changes).  There are
other differences, but none that would appear that they should have
this effect.  Here are the configure commands used for each system:

test system:
===
'./configure' '--with-mysql=/usr/local/mysql' '--with-pgsql=/usr/local/pgsql'
'--with-gettext' '--with-xml' '--with-imap' '--with-imap-ssl' '--with-pspell'
'--with-zlib' '--with-zlib-dir=/usr' '--with-bz2' '--with-ndbm' '--enable-dba'
'--with-gd' '--enable-gd-native-ttf' '--with-freetype-dir=/usr/local'
'--with-jpeg-dir=/usr/local' '--with-tiff-dir=/usr/local'
'--with-png-dir=/usr/local' '--with-tidy' '--with-openssl' '--enable-sysvsem'
'--enable-sysvshm' '--enable-dbase' '--enable-ftp' '--enable-memory-limit'
'--enable-inline-optimization' '--disable-debug'
'--with-apxs2=/usr/local/apache2/bin/apxs' '--prefix=/usr/local/php'
'--with-config-file-path=/usr/local/php'

development system:

'./configure' '--enable-versioning' '--enable-memory-limit' '--with-layout=GNU'
'--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all'
'--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-reflection'
'--enable-spl' '--program-prefix=' 

[PHP] Segmentation fault using imap_open

2006-12-12 Thread Richard Morris

Hello all,

I was experimenting with the imap_* library functions trying to see if I 
could get a PHP script to access a folder on our IMAP server and I ran 
into a problem.


I was trying to get a simple script to work which simply opened a 
connection to the mail server and then closed it but when I ran the 
script it caused a segmentation fault on the imap_open line.  Here is 
the code I was trying to run:


?php
  $mailbox = '{mail.hddbroker.com:143}INBOX';
  $username = 'xxx';
  $password = 'yyy';

  $mbox = imap_open($mailbox, $username, $password);
  imap_close($mbox);
?

and on the CLI it produced the output: Segmentation fault (core dumped)

I configured my PHP installation with --enable-debug and using the core 
dump, I got the following backtrace:


#0  0x00144019 in SSL_SESSION_hash () from /lib/libssl.so.4
#1  0x001ca484 in lh_free () from /lib/libcrypto.so.4
#2  0x001ca5f3 in lh_delete () from /lib/libcrypto.so.4
#3  0x00148141 in SSL_CTX_get_timeout () from /lib/libssl.so.4
#4  0x001ca56e in lh_retrieve () from /lib/libcrypto.so.4
#5  0x001481f7 in SSL_CTX_flush_sessions () from /lib/libssl.so.4
#6  0x001441a3 in SSL_CTX_free () from /lib/libssl.so.4
#7  0x005185ac in ssl_close () from /usr/lib/libc-client.so.0
#8  0x0051851f in ssl_close () from /usr/lib/libc-client.so.0
#9  0x005176c3 in ssl_aopen () from /usr/lib/libc-client.so.0
#10 0x0054a697 in imap_open () from /usr/lib/libc-client.so.0
#11 0x00523a90 in mail_open () from /usr/lib/libc-client.so.0
#12 0x0814dcfc in zif_imap_open (ht=3, return_value=0xb7c8bc9c, 
return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)

at /usr/local/src/php-5.2.0/ext/imap/php_imap.c:780
#13 0x08332c92 in zend_do_fcall_common_helper_SPEC 
(execute_data=0xbfe372e0) at 
/usr/local/src/php-5.2.0/Zend/zend_vm_execute.h:200
#14 0x08332419 in execute (op_array=0xb7c8b68c) at 
/usr/local/src/php-5.2.0/Zend/zend_vm_execute.h:92
#15 0x0831aa9b in zend_execute_scripts (type=8, retval=0x0, 
file_count=3) at /usr/local/src/php-5.2.0/Zend/zend.c:1097
#16 0x082e4a51 in php_execute_script (primary_file=0xbfe397d0) at 
/usr/local/src/php-5.2.0/main/main.c:1758
#17 0x08393462 in main (argc=2, argv=0xbfe398a4) at 
/usr/local/src/php-5.2.0/sapi/cli/php_cli.c:1108



It doesn't mean too much to me but I thought someone might be able to 
understand it.  Here is some additional details that might be needed:


PHP Version: PHP 5.2.0 (cli) (built: Nov  3 2006 06:07:03)
OS: CentOS 4.4 i386
RPM packages installed:
  - openssl-0.9.7a-43.14
  - openssl-devel-0.9.7a-43.14
  - libc-client-2002e-14
  - libc-client-devel-2002e-14

There was a bug opened that has the same segmentation problem but the 
scenario seems to be different including using a different version 
number.  PHP Bug #39726 (http://bugs.php.net/bug.php?id=39726)


If there are any other details I can provide or if someone could point 
my in another direction that would help, I would really appreciate it.


Thank you.
--
Richard Morris
HDD Broker, Inc.

Toll-Free: +1 866 960-3331
International: +1 250 474-6022
  Fax: +1 250 474-6099
   E-Mail: [EMAIL PROTECTED]
 Web Site: www.hddbroker.com

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



Re: [PHP] $POST Q

2006-12-12 Thread Chris

William Stokes wrote:

Hello,

Can someone tell me what wrong or to how to manage this?

//default
$limitorig = 10;

echo select name=\USRlimitorig\;
echo option selected value=$limitorig/option;
echo option10/option;
echo option20/option;
echo option30/option;
echo input type=\submit\ name=\resetlimit\ value=\GO\;


Something like this would be better:

$limitorig = 10;
$options = array('10', '20', '30');

if (isset($_POST['limitorig'])  in_array($_POST['limitorig'], $options)) {
  $limitorig = $_POST['limitorig'];
}

foreach ($options as $option) {
  $selected = '';
  if ($option == $limitorig) {
$selected = ' SELECTED';
  }
  echo 'option value=' . $option . ' ' . $selected . '' . $option . 
'/option';

}


might be a bit long winded but you can easily add more to the array, the 
in_array check makes sure nobody tries to hack the script by entering 
dummy values (or by creating their own script to submit the form) and it 
should also stop xss attacks.


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

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



RE: [PHP] Cookies page refresh

2006-12-12 Thread Peter Lauri
Hi,

I think it says somewhere in the documentation that the cookie values will
not be available until next request/response...

/Peter


-Original Message-
From: William Stokes [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 12, 2006 5:28 PM
To: php-general@lists.php.net
Subject: [PHP] Cookies  page refresh

Hello,

I have a page that uses session cookies for deciding what content to show to

a visitor. User also has 2 form objecks to apply filters to the content SQL 
queries. So at the beginning of the script I set 2 cookies based on user 
selections(or defaults) and after that make DB query based on user 
selections. I wanted to use cookies because there also back - up - 
forward links for pagination.

Problem is that in order to get the cookie based system to work the page 
needs a refresh to read the cookies and display content corretly. Is this 
because the page loads faster than the server set's the cookies to client 
browser? If so what's the corrert / best way to implement the filters and 
page navigation if there's 2 form select lists and 3 links to navigate the 
page.

Thanks
-Will

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

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



Re: [PHP] Cookies page refresh

2006-12-12 Thread Chris

William Stokes wrote:

Hello,

I have a page that uses session cookies for deciding what content to show to 
a visitor. User also has 2 form objecks to apply filters to the content SQL 
queries. So at the beginning of the script I set 2 cookies based on user 
selections(or defaults) and after that make DB query based on user 
selections. I wanted to use cookies because there also back - up - 
forward links for pagination.


Problem is that in order to get the cookie based system to work the page 
needs a refresh to read the cookies and display content corretly. Is this 
because the page loads faster than the server set's the cookies to client 
browser? If so what's the corrert / best way to implement the filters and 
page navigation if there's 2 form select lists and 3 links to navigate the 
page.


Use a session variable instead. Otherwise I could modify the cookie and 
change the query / queries being run really easily... causing sql 
injection and a bunch of other issues.


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

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



Re: [PHP] Retransmiting post variables

2006-12-12 Thread Chris

Fernando M. M. wrote:


Hello,

I have a script called redir.php that is used only for redirecting
using the following code:

header('Location: ', $_GET['url']);

But
now i need to redirect post varibles too. Example:

If someone access
redir.php?url=my_page.php and post:

a=1b=2

I need to
send this post string (as post) to my_page.php.


$post_string = '';
foreach ($_POST as $k = $v) {
  $post_string .= $k . '=' . $v . '';
}

$url .= $post_string;

however that's *really* insecure - you're not doing any sanity checks on 
any of the posted data.


You need to implement some checks (ie make sure the field you want as a 
number is a number and so on).


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

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



Re: [PHP] Whitespace in Emails

2006-12-12 Thread Chris

[EMAIL PROTECTED] wrote:
I'm experiencing a strange problem and difficult to diagnose because 
it's random. I have built an application that sends out an email with a 
nice amount of text (don't have exact char count, but could get it).


On the html email, a random whitespace appears in the content, but 
always toward the end pointing to a possible character count issue.


See below for examples of how the space wanders and is random:

1- Th ere are several things being discussed in this email.
2- There are se veral things being discussed in this email.
3- There are severa l things being discussed in this email.

This whitepace issue happens after the email is sent.

Anybody have any ideas?


The MTA is wrapping the text at 1,024 characters if you're not doing it. 
Use http://php.net/wordwrap to wrap it at specific lengths.


If it's a text-only email, add 'format=flowed;' to your headers:

Content-Type: text/plain; format=flowed;

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

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



Re: [PHP] Varying session behavior between 2 nearly identical Apache/PHP setups

2006-12-12 Thread Chris

Matthew North wrote:

Hello All,

I have an odd situation that I wonder if someone might have some
insight on.  The scenario is this:

- Two FreeBSD systems running Apache+mod_php+others.  We use one for
development and the other for testing.

- Each system is running PHP 5.2.0 with identical php.ini files.

- On each system we have identical PHP code (confirmed to be identical
by comparing cksum output) that looks essentially like this:

=== snip ===
?php
.
. [page setup code]
.
trigger_error('['.session_id().']');
if (needSession  !session_id())
   session_start();
trigger_error('['.session_id().']');
.
. [page output code]
.
?
=== snip ===

Errors are logged to file rather than the page, so the trigger_error()
calls above result in entries similar to:

[08-Dec-2006 16:59:23] PHP Notice:  [] in /path/to/file.php on line 178

[08-Dec-2006 16:59:23] PHP Notice: [GmQidWwShpRpHCGDiQrBr-Lk4ib] in
/path/to/file.php on line 181

So it appears a session is started.

However, on the test system a session cookie is never sent back to the
browser so the session cannot be restored, while on the development
system everything works as it should (session cookie is set and
session is therefore restored on each page load).

Using 'wget -S', here are the response headers sent by the development 
system:


$ wget -S http://dev/ajax/shopping_list.php\?action=add\SKU=ABC
--15:48:41--  http://dev/ajax/shopping_list.php?action=addSKU=ABC
  = `shopping_list.php?action=addSKU=ABC.1'
Resolving dev... 192.168.0.30
Connecting to dev|192.168.0.30|:80... connected.
 HTTP/1.1 200 OK
 Date: Mon, 11 Dec 2006 23:48:41 GMT
 Server: Apache/2.2.3 (FreeBSD) mod_ssl/2.2.3 OpenSSL/0.9.7e-p1 DAV/2
PHP/5.2.0 with Suhosin-Patch mod_ruby/1.2.5 Ruby/1.8.5(2006-08-25) 
SVN/1.4.2

mod_jk/1.2.15
 X-Powered-By: PHP/5.2.0
 Set-Cookie: PHPSESSID=WJ33PpO,nphiPAVxrbrWrQEnO5a; path=/
 Expires: Thu, 19 Nov 1981 08:52:00 GMT
 Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
 Pragma: no-cache
 Content-Length: 103
 Keep-Alive: timeout=15, max=100
 Connection: Keep-Alive
 Content-Type: application/xml
Length: 103 [application/xml]


And on the live server:


$ wget -S http://test/ajax/shopping_list.php\?action=add\SKU=ABC
--15:48:26--  http://test/ajax/shopping_list.php?action=addSKU=ABC
  = `shopping_list.php?action=addSKU=ABC'
Resolving test... 192.168.0.31
Connecting to test|192.168.0.31|:80... connected.
HTTP request sent, awaiting response...
 HTTP/1.1 200 OK
 Date: Mon, 11 Dec 2006 23:48:26 GMT
 Server: Apache/2.0.59 (Unix) mod_ssl/2.0.59 OpenSSL/0.9.7e-p1 SVN/1.3.2
PHP/5.2.0 DAV/2
 X-Powered-By: PHP/5.2.0
 Content-Length: 103
 Keep-Alive: timeout=15, max=100
 Connection: Keep-Alive
 Content-Type: application/xml
Length: 103 [application/xml]


No session cookie!  Note that the bodies of these two responses are
identical as determined using diff.  Also note that we have other sets
of code on the test system which call session_start(), and a session
cookie _is_ set, as it should be, and everything works fine.  So it's
not simply that the session module is broken or mis-configured on the
test machine.  Under most circumstances sessions work fine on both
systems.  This implies that there is something specific about the code
that is running in the [page setup code] and/or [page output code]
(refer to snippet above) that is causing session_start() to behave
unusually.  But again, the PHP code is identical, so it must be the
code *in combination with* some other external difference between the
two systems.

The only differences between the two systems that could conceivably
make sense (to my mind) in terms of this differing behavior are:
Apache 2.0.59 and no Suhosin patch on the test machine, vs Apache
2.2.3 _with_ Suhosin patch on the development system (and I mention
Suhosin only because it makes some cookie-related changes).  There are
other differences, but none that would appear that they should have
this effect.  Here are the configure commands used for each system:

test system:
===
'./configure' '--with-mysql=/usr/local/mysql' 
'--with-pgsql=/usr/local/pgsql'
'--with-gettext' '--with-xml' '--with-imap' '--with-imap-ssl' 
'--with-pspell'
'--with-zlib' '--with-zlib-dir=/usr' '--with-bz2' '--with-ndbm' 
'--enable-dba'

'--with-gd' '--enable-gd-native-ttf' '--with-freetype-dir=/usr/local'
'--with-jpeg-dir=/usr/local' '--with-tiff-dir=/usr/local'
'--with-png-dir=/usr/local' '--with-tidy' '--with-openssl' 
'--enable-sysvsem'

'--enable-sysvshm' '--enable-dbase' '--enable-ftp' '--enable-memory-limit'
'--enable-inline-optimization' '--disable-debug'
'--with-apxs2=/usr/local/apache2/bin/apxs' '--prefix=/usr/local/php'
'--with-config-file-path=/usr/local/php'

development system:

'./configure' '--enable-versioning' '--enable-memory-limit' 
'--with-layout=GNU'

'--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all'
'--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-reflection'

Re: [PHP] Segmentation fault using imap_open

2006-12-12 Thread Chris

Richard Morris wrote:

Hello all,

I was experimenting with the imap_* library functions trying to see if I 
could get a PHP script to access a folder on our IMAP server and I ran 
into a problem.


I was trying to get a simple script to work which simply opened a 
connection to the mail server and then closed it but when I ran the 
script it caused a segmentation fault on the imap_open line.  Here is 
the code I was trying to run:


?php
  $mailbox = '{mail.hddbroker.com:143}INBOX';
  $username = 'xxx';
  $password = 'yyy';

  $mbox = imap_open($mailbox, $username, $password);
  imap_close($mbox);
?

and on the CLI it produced the output: Segmentation fault (core dumped)

I configured my PHP installation with --enable-debug and using the core 
dump, I got the following backtrace:


#0  0x00144019 in SSL_SESSION_hash () from /lib/libssl.so.4
#1  0x001ca484 in lh_free () from /lib/libcrypto.so.4
#2  0x001ca5f3 in lh_delete () from /lib/libcrypto.so.4
#3  0x00148141 in SSL_CTX_get_timeout () from /lib/libssl.so.4
#4  0x001ca56e in lh_retrieve () from /lib/libcrypto.so.4
#5  0x001481f7 in SSL_CTX_flush_sessions () from /lib/libssl.so.4
#6  0x001441a3 in SSL_CTX_free () from /lib/libssl.so.4
#7  0x005185ac in ssl_close () from /usr/lib/libc-client.so.0
#8  0x0051851f in ssl_close () from /usr/lib/libc-client.so.0
#9  0x005176c3 in ssl_aopen () from /usr/lib/libc-client.so.0
#10 0x0054a697 in imap_open () from /usr/lib/libc-client.so.0
#11 0x00523a90 in mail_open () from /usr/lib/libc-client.so.0
#12 0x0814dcfc in zif_imap_open (ht=3, return_value=0xb7c8bc9c, 
return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)

at /usr/local/src/php-5.2.0/ext/imap/php_imap.c:780
#13 0x08332c92 in zend_do_fcall_common_helper_SPEC 
(execute_data=0xbfe372e0) at 
/usr/local/src/php-5.2.0/Zend/zend_vm_execute.h:200
#14 0x08332419 in execute (op_array=0xb7c8b68c) at 
/usr/local/src/php-5.2.0/Zend/zend_vm_execute.h:92
#15 0x0831aa9b in zend_execute_scripts (type=8, retval=0x0, 
file_count=3) at /usr/local/src/php-5.2.0/Zend/zend.c:1097
#16 0x082e4a51 in php_execute_script (primary_file=0xbfe397d0) at 
/usr/local/src/php-5.2.0/main/main.c:1758
#17 0x08393462 in main (argc=2, argv=0xbfe398a4) at 
/usr/local/src/php-5.2.0/sapi/cli/php_cli.c:1108



It doesn't mean too much to me but I thought someone might be able to 
understand it.  Here is some additional details that might be needed:


PHP Version: PHP 5.2.0 (cli) (built: Nov  3 2006 06:07:03)
OS: CentOS 4.4 i386
RPM packages installed:
  - openssl-0.9.7a-43.14
  - openssl-devel-0.9.7a-43.14
  - libc-client-2002e-14
  - libc-client-devel-2002e-14

There was a bug opened that has the same segmentation problem but the 
scenario seems to be different including using a different version 
number.  PHP Bug #39726 (http://bugs.php.net/bug.php?id=39726)


If there are any other details I can provide or if someone could point 
my in another direction that would help, I would really appreciate it.


If you don't have any luck here, try the php-internals list. All of the 
php c-developers reside on that list, they will have a better idea on 
how to approach this.


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

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



Re: [PHP] Cookies page refresh

2006-12-12 Thread William Stokes
Thanks.

It seems that I tested the right things but in a wrong order...

-Will

Chris [EMAIL PROTECTED] kirjoitti 
viestissä:[EMAIL PROTECTED]
 William Stokes wrote:
 Hello,

 I have a page that uses session cookies for deciding what content to show 
 to a visitor. User also has 2 form objecks to apply filters to the 
 content SQL queries. So at the beginning of the script I set 2 cookies 
 based on user selections(or defaults) and after that make DB query based 
 on user selections. I wanted to use cookies because there also back - 
 up - forward links for pagination.

 Problem is that in order to get the cookie based system to work the page 
 needs a refresh to read the cookies and display content corretly. Is this 
 because the page loads faster than the server set's the cookies to client 
 browser? If so what's the corrert / best way to implement the filters 
 and page navigation if there's 2 form select lists and 3 links to 
 navigate the page.

 Use a session variable instead. Otherwise I could modify the cookie and 
 change the query / queries being run really easily... causing sql 
 injection and a bunch of other issues.

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

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



[PHP] How php works?

2006-12-12 Thread Kai Xiang

Hello all:

I'm new here and looking PHP these days, howerver , I'm confused by how it
works, and here is some questions I have.
Is there any old bird wanna help me out?

1. I heard there is a zend engine inside PHP playing the role as a virtual
machine, and PHP excution have 2 step, first compile to opcode and then
excute the opcode,
so is that means the php are compiled only once per file? or still need to
recompile when another request issued to the server? also I heard about the
caching extention about php, is it talking about caching the opcode? is't
caching the opcode or excute results? how it shares between the requests?

2. Is there some alternative choise except zend engineen, why need a zend
engine? for performance advantage or just easy for porting to different
platform?

3. Take linux apache for example, if compiled as a apache module, and using
prefork threading model, for example, if I have 100 process, is that means I
have 100 copy of PHP library local data(I assume only one reentrant
excutable image) in each process? compare to a worker model, like 10 process
and 10 threads in each one process, should it make a difference that we only
have 10 copy of PHP library local data ?

I'm not sure if this is the right place to talk about this, anyway, if you
know a better place, help me out :)
Thanks in advantage

Regards
Kai


RE: FW: [PHP] Re: Please hack my app

2006-12-12 Thread Jordan Forssman
Hi Ivo,

Sorry for the late reply, I have been traveling. 
I am assigning someone to your case who will assist you in understanding
the cause of the inclusion of the vulnerability in your own functions.
To my understanding it is that it could be the result of a repetition of
an instance discovered in your function. If you are then to include the
function a number of times, the vulnerability will be identified in all
those instances. 

However, I am assigning someone to this question who will give you a
better answer, his name is Chris.

As to your comments, I would greatly appreciate them.

Thanks and all the best, 

Jordan Forssman
Sales Manager
Armorize Technologies 
US: 
Tel: +1-408-512-4052 ext. 201
Fax: +1-408-247-1570
TW:
Tel. +886-2-6616-0100 ext. 201
Cell. +886-938-100-214
Fax. +886-2-6616-1100
Skype: jordan4z
[EMAIL PROTECTED]

-Original Message-
From: Ivo F.A.C. Fokkema [mailto:I.F.A.C. [EMAIL PROTECTED] 
Sent: Saturday, December 02, 2006 12:26 AM
To: php-general@lists.php.net
Subject: Re: FW: [PHP] Re: Please hack my app

Hi Jordan,

Thank you for your offer. As you know, I've signed up a couple of days
ago. I ran a scan yesterday and have gotten a big PDF file out of it.
I've quickly scanned through the results and it appears there are a lot
of
times when I use one of my own functions (sometimes even without an
argument) it finds a vulnerability. I will analyze the results more
detailed later on. Would you appreciate comments on the service?

Thanks again,

Ivo


On Tue, 28 Nov 2006 14:19:30 +0800, Jordan Forssman wrote:

 Hi,
 
 My name is Jordan Forssman, I am representing a company called
Armorize
 Technologies. We have developed a source code analysis platform for
PHP,
 called CodeSecure, which scans source code for SQL injection, cross
site
 scripting, command injection, etc, vulnerability. The tool will tell
you
 exactly which line the vulnerability is on, explain the propagation of
 the tainted variables, and assist you in fixing the bug. I believe
this
 tool will help you verify the security of your application and will be
 able to do so very quickly. At the moment we are scanning around 20
000
 lines in under 5 minutes, or 1M in about 2 minutes, depending on the
 application. 
 
 Currently we are accepting applications for trial accounts, if you
would
 like to use our tool to scan your code please log on to
 http://www.armorize.com/events/trialapplication   and submit the form.
 We are just starting our sales and marketing effort so I hope you can
 use our product and give us some feedback. 
 
 If you want to know more about our company and product you can find us
 at: www.armorize.com , download our datasheets and whitepapers at
 www.armorize.com/resources/download .  
 
 The trial is free and can be accessed over the Web, we are using the
 trials as a test case for offering the product as a service and also
to
 promote the product. Once I receive your application I will send you
an
 e-mail with a quickstart guide and login details. 
 
 If you have any questions, please feel free to contact me anytime.
 
 Best Regards,
 
 Jordan Forssman
 Sales Manager
 Armorize Technologies
 Tel. +886-2-6616-0100 ext. 201
 Cell. +886-938-100-214
 Fax. +886-2-6616-1100
 Skype: jordan4z
 [EMAIL PROTECTED] 
 [EMAIL PROTECTED] 
 
 
 -Original Message-
 From: Ivo F.A.C. Fokkema [mailto:I.F.A.C. [EMAIL PROTECTED] 
 Sent: Monday, November 27, 2006 6:01 PM
 To: php-general@lists.php.net
 Subject: [PHP] Re: Please hack my app
 
 On Wed, 22 Nov 2006 09:57:50 +0100, Ivo F.A.C. Fokkema wrote:
 
 Hi List,
 
 As this subject may start you wondering what the hell I'm thinking,
 let me
 clearify:
 
 I've been rewriting an GPL'ed PHP/MySQL app from scratch for the last
 12
 months or so. It facilitates storage of DNA mutations and the
 corresponding patient data. Because patient data is involved, privacy
 is
 very important.
 Now of course I read lots of pages on SQL injection and whatnot, and
I
 strongly believe my application is protected from this kind of abuse.
 However, believing is not enough. I've had some comments in the past
 about
 security (previous version of the software) and although I didn't
 agree to
 the critic, I want to be able to say the new app went though various
 forms
 of attacks. This month, I want to release 2.0-alpha-01...
 
 *** THIS IS NOT ABOUT HACKING THE SERVER ***
 But about getting in the application when you're not allowed to!
 
 If you feel like helping me out, it's located at
 http://chromium.liacs.nl/LOVDv.2.0-dev/
 
 1) Please try to get in. There's one account in the system, a
database
 administrator, capable of doing anything. If you get in, you can
 easily
 create a new user using the setup tab. This will be the prove of you
 breaking my security rules.
 
 2) Can you manage to view unpublic data? Using the Variants tab, you
 can see there is currently one entry in the database (with two
 mutations).
 This entry has a hidden column, called 'Patient ID'. There 

[PHP] Paste variable from popup to previous page?

2006-12-12 Thread William Stokes
Hello,

How can I pass a variable from popup window back to the page that originally 
opened the popup? Or can I?

Thanks
-Will

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



[PHP] Paste variable from popup to previous page?

2006-12-12 Thread William Stokes
Hello,

How can I pass a variable from popup window back to the page that originally 
opened the popup? Or can I?

Thanks
-Will

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