php-general Digest 3 Aug 2008 10:57:35 -0000 Issue 5604

2008-08-03 Thread php-general-digest-help

php-general Digest 3 Aug 2008 10:57:35 - Issue 5604

Topics (messages 277638 through 277644):

Re: Returning response includes HTML form data
277638 by: Maciek Sokolewicz
277639 by: Edward Diener

PHP 5 auto-htmlentitizing strings?
277640 by: Weston C

Re: Exposing PHP/errors on production vs. dev
277641 by: Chacha C
277642 by: Daniel Brown

PHP page completly blank
277643 by: Alain Roger

dynamic extension
277644 by: Alain Roger

Administrivia:

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

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

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


--
---BeginMessage---

Edward Diener wrote:

Benjamin Hawkes-Lewis wrote:

Edward Diener wrote:
Does not the script 'exit' when the PHP code reaches the ending

'?' tag ?


Not exactly. PHP processes the remainder of the file too, it just 
doesn't find any PHP code to execute therein. It does find some text 
to output, and it outputs it. That text happens to be a form.


Now I see. Just like in normal HTML processing a request to a URL which 
is an HTML page, sends the HTML markup back to the client. My PHP page 
is a normal HTML page with PHP processing embedded in it. Hit me on the 
head and wake me up g.


How does one stop PHP from outputting data in a PHP file outside of the 
PHP tags ? Hopefully there is a technique for that. can I just 'exit' in 
the PHP processing code in order to do that ? It seems that should work 
and I will try it.

yes, you can do that.

In my case I am using the form data just to process the request and not 
to be sent back to the client, especially as a form itself is not a 
complete HTML page.

You could also conditially display it, like so:

?php
if(isset($_GET['something'])  $_GET['something'] == 'something else') {
   // do something with the data
} else {
   ?
   form.../form
?php
}
?

or perhaps like so, by setting a flag:
?php
$processed = false;
if(isset($_GET['something'])  $_GET['something'] == 'something else') {
   // do something with the data
   $processed = true;
}

// lots of stuff going on here

if($processed === false) {
?
   form.../form
?php
}
?
---End Message---
---BeginMessage---

Maciek Sokolewicz wrote:

Edward Diener wrote:

Benjamin Hawkes-Lewis wrote:

Edward Diener wrote:
Does not the script 'exit' when the PHP code reaches the ending

'?' tag ?


Not exactly. PHP processes the remainder of the file too, it just 
doesn't find any PHP code to execute therein. It does find some text 
to output, and it outputs it. That text happens to be a form.


Now I see. Just like in normal HTML processing a request to a URL 
which is an HTML page, sends the HTML markup back to the client. My 
PHP page is a normal HTML page with PHP processing embedded in it. Hit 
me on the head and wake me up g.


How does one stop PHP from outputting data in a PHP file outside of 
the PHP tags ? Hopefully there is a technique for that. can I just 
'exit' in the PHP processing code in order to do that ? It seems that 
should work and I will try it.

yes, you can do that.

In my case I am using the form data just to process the request and 
not to be sent back to the client, especially as a form itself is not 
a complete HTML page.

You could also conditially display it, like so:

?php
if(isset($_GET['something'])  $_GET['something'] == 'something else') {
   // do something with the data
} else {
   ?
   form.../form
?php
}
?

or perhaps like so, by setting a flag:
?php
$processed = false;
if(isset($_GET['something'])  $_GET['something'] == 'something else') {
   // do something with the data
   $processed = true;
}

// lots of stuff going on here

if($processed === false) {
?
   form.../form
?php
}
?


OK, thanks ! In my case I never want to send the form back to the client 
since it exists only to handle an HTTP POST on the server side.
---End Message---
---BeginMessage---
I just switched over an app from PHP 4 to PHP 5, and one of the weird
things I'm noticing initially is that some of the html output seems to
be html entitized. For example, a link that was showing up in html
output as:

 a href=http://metaphilm.com/philm.php?id=29_0_2_0;Is Tyler Durden
Hobbes?/a

now gets transformed to:

lt;a href=http://metaphilm.com/philm.php?id=29_0_2_0gt;Is Tyler
Durden Hobbeslt;/agt;

No other changes in the PHP source -- just a change in the interpreter.

Any idea what could be causing this?

Thanks,

Weston
---End Message---
---BeginMessage---
Somehow .. I feel this isn't PHP Related.

On Sat, Aug 2, 2008 at 11:08 AM, Robert Cummings [EMAIL PROTECTED]wrote:

 On Sat, 2008-08-02 at 14:01 -0400, Daniel Brown wrote:
  On Sat, Aug 2, 2008 at 1:58 PM, Robert Cummings [EMAIL PROTECTED]
 wrote:
  
   Sorry, I hired a profession for the chair throwing-- my bulldog Steve
   Ballmer!
 
  More wasteful spending by the Canadian.  You know 

php-general Digest 4 Aug 2008 01:06:51 -0000 Issue 5605

2008-08-03 Thread php-general-digest-help

php-general Digest 4 Aug 2008 01:06:51 - Issue 5605

Topics (messages 277645 through 277653):

Re: Exposing PHP/errors on production vs. dev
277645 by: tedd

Re: PHP page completly blank
277646 by: Daniel Brown
277647 by: Alain Roger

php.ini and pgsql extension issue
277648 by: Alain Roger

Re: uploading big files with PHP
277649 by: mike
277650 by: brian
277653 by: mike

Re: remembering where the user is on the page??
277651 by: brian

Re: PHP Memory Management
277652 by: brian

Administrivia:

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

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

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


--
---BeginMessage---

At 1:04 AM -0400 8/3/08, Daniel Brown wrote:

On Sun, Aug 3, 2008 at 12:22 AM, Chacha C [EMAIL PROTECTED] wrote:
  Somehow .. I feel this isn't PHP Related.

Boy, nothing gets by you, eh?  Welcome to the list, new meat.


Hey, he said he feels that it wasn't PHP Related. That's not like 
knowing it wasn't.


Welcome, new dude.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com
---End Message---
---BeginMessage---
On Sun, Aug 3, 2008 at 3:54 AM, Alain Roger [EMAIL PROTECTED] wrote:

 when under command line i run php -v i get a lot of error messages, like
 those 2 as attached files.
 what can it be ? i've checked those files and they exist. :-(

Attached files are stripped automatically by mailman before
redistributing messages to the list.

Please copy and paste the errors into the body of the message instead.

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.
---End Message---
---BeginMessage---
Ok i found where was the problem.
basically when i install php 5.2.6 with installer.msi, i must after copy
over those files, the content of the php-5.2.6-Win32.zip file, because
several files and links are not installed / done by the installer.msi :-(
just try to install it with default settings and you will see that in
php.ini there is not section for windows extensions like in previous version
so we can not dynamically add a module. Or for example, even if you select
some module a the installation time, the files are installed but when you
type php -v at command line, you get an error that the file libpq.dll is not
available (whereas it is)... plus some other librairies (dll) files.


On 8/3/08, Daniel Brown [EMAIL PROTECTED] wrote:

 On Sun, Aug 3, 2008 at 3:54 AM, Alain Roger [EMAIL PROTECTED] wrote:
 
  when under command line i run php -v i get a lot of error messages, like
  those 2 as attached files.
  what can it be ? i've checked those files and they exist. :-(


 Attached files are stripped automatically by mailman before
 redistributing messages to the list.

 Please copy and paste the errors into the body of the message instead.


 --
 /Daniel P. Brown
 Better prices on dedicated servers:
 Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
 Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
 Dedicated servers, VPS, and hosting from $2.50/mo.




-- 
Alain

Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008
---End Message---
---BeginMessage---
Hi,

i found and solved an interesting issue under PHP 5.2.6.

when i use the standard installation file under windows XP
(php-5.2.6-win32-installer.msi), i get several error message in apache
error.log file, something like :
PHP Warning:  PHP Startup: Unable to load dynamic library
'D:\\webserver\\PHP\\ext\\php_mssql.dll' - The specified module could not be
found.\r\n in Unknown on line 0

and this for several extensions even if the files are correctly installed in
the right folder.
I took a previous version of PHP 5.2.3 extension (dll) and i compare the
size:
in PHP 5.2.6, php_pgsql.dll is 96 kb whereas it is 164 kb under PHP 5.2.3.

so i just replace the 96 kb file by the 164 kb and restart apache 2.2.8. now
it works perfectly.
i reproduced the same thing for all dynamic extensions which were generating
the same issue and all works.

it could be interesting that developers of PHP take an eye on it.

-- 
Alain

Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008
---End Message---
---BeginMessage---
On 7/25/08, Angelo Zanetti [EMAIL PROTECTED] wrote:
 Hi all

 We are pitching to develop a website where the admin has to upload big video
 files but I'm not sure how this can be done as the file upload will most
 probably time out.

 How do current websites do it? Is there somehow a way to make use of FTP to
 transfer the files?

 Any links, help, advice will be appreciated.

 Thanks in advance

Use the PUT 

[PHP] PHP page completly blank

2008-08-03 Thread Alain Roger
Hi,

i reinstalled on my computer (Win XP) PHP 5.2.4 (but the same happens with
5.2.6).
when i run an index.php page or any other php page which works well before,
now i get a blank page result on my browser without any error message. even
if only HTML code is inside the PHP page nothing is displayed.
it's enough that page as *.php extension to reproduce such issue.

when under command line i run php -v i get a lot of error messages, like
those 2 as attached files.
what can it be ? i've checked those files and they exist. :-(

thanks a lot for your help.

-- 
Alain

Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] dynamic extension

2008-08-03 Thread Alain Roger
Hi,

i do not see anymore the dynamic extension part in php.ini file, under PHP
5.2.6.
is it normal ?

thx

-- 
Alain

Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008


Re: [PHP] Re: Exposing PHP/errors on production vs. dev

2008-08-03 Thread tedd

At 1:04 AM -0400 8/3/08, Daniel Brown wrote:

On Sun, Aug 3, 2008 at 12:22 AM, Chacha C [EMAIL PROTECTED] wrote:
  Somehow .. I feel this isn't PHP Related.

Boy, nothing gets by you, eh?  Welcome to the list, new meat.


Hey, he said he feels that it wasn't PHP Related. That's not like 
knowing it wasn't.


Welcome, new dude.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] PHP page completly blank

2008-08-03 Thread Daniel Brown
On Sun, Aug 3, 2008 at 3:54 AM, Alain Roger [EMAIL PROTECTED] wrote:

 when under command line i run php -v i get a lot of error messages, like
 those 2 as attached files.
 what can it be ? i've checked those files and they exist. :-(

Attached files are stripped automatically by mailman before
redistributing messages to the list.

Please copy and paste the errors into the body of the message instead.

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] PHP page completly blank

2008-08-03 Thread Alain Roger
Ok i found where was the problem.
basically when i install php 5.2.6 with installer.msi, i must after copy
over those files, the content of the php-5.2.6-Win32.zip file, because
several files and links are not installed / done by the installer.msi :-(
just try to install it with default settings and you will see that in
php.ini there is not section for windows extensions like in previous version
so we can not dynamically add a module. Or for example, even if you select
some module a the installation time, the files are installed but when you
type php -v at command line, you get an error that the file libpq.dll is not
available (whereas it is)... plus some other librairies (dll) files.


On 8/3/08, Daniel Brown [EMAIL PROTECTED] wrote:

 On Sun, Aug 3, 2008 at 3:54 AM, Alain Roger [EMAIL PROTECTED] wrote:
 
  when under command line i run php -v i get a lot of error messages, like
  those 2 as attached files.
  what can it be ? i've checked those files and they exist. :-(


 Attached files are stripped automatically by mailman before
 redistributing messages to the list.

 Please copy and paste the errors into the body of the message instead.


 --
 /Daniel P. Brown
 Better prices on dedicated servers:
 Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
 Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
 Dedicated servers, VPS, and hosting from $2.50/mo.




-- 
Alain

Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008


[PHP] php.ini and pgsql extension issue

2008-08-03 Thread Alain Roger
Hi,

i found and solved an interesting issue under PHP 5.2.6.

when i use the standard installation file under windows XP
(php-5.2.6-win32-installer.msi), i get several error message in apache
error.log file, something like :
PHP Warning:  PHP Startup: Unable to load dynamic library
'D:\\webserver\\PHP\\ext\\php_mssql.dll' - The specified module could not be
found.\r\n in Unknown on line 0

and this for several extensions even if the files are correctly installed in
the right folder.
I took a previous version of PHP 5.2.3 extension (dll) and i compare the
size:
in PHP 5.2.6, php_pgsql.dll is 96 kb whereas it is 164 kb under PHP 5.2.3.

so i just replace the 96 kb file by the 164 kb and restart apache 2.2.8. now
it works perfectly.
i reproduced the same thing for all dynamic extensions which were generating
the same issue and all works.

it could be interesting that developers of PHP take an eye on it.

-- 
Alain

Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008


Re: [PHP] uploading big files with PHP

2008-08-03 Thread mike
On 7/25/08, Angelo Zanetti [EMAIL PROTECTED] wrote:
 Hi all

 We are pitching to develop a website where the admin has to upload big video
 files but I'm not sure how this can be done as the file upload will most
 probably time out.

 How do current websites do it? Is there somehow a way to make use of FTP to
 transfer the files?

 Any links, help, advice will be appreciated.

 Thanks in advance

Use the PUT method
- requires webserver configuration to support it
- requires PHP to open the stream using php://input
- supports resuming (the client needs to give the script something
like ?offset=1234 and the PHP script needs to fseek() to that position
in the file)

Variety of options for uploading this way:
- anything that can leverage curl/libcurl
- browser plugins - lots of java ones, haven't found a flash one yet

Bonuses:
- Can run over ssl/https - since its just HTTP talking, so proxies are okay
- Can resume
- Doesn't require a two-step process for people to upload things (FTP,
SFTP to server, then go somewhere and associate the file, etc)

We'll be using this method we just wish there were nicer frontends,
most of the java ones are ugly as sin.

javauploader.com mentioned does not look like it supports PUT. however
I believe all of these do:

http://www.jfileupload.com/products/jfileupload/
http://www.radinks.com/upload/plus/resume.php
http://upload.thinfile.com/features.php

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



Re: [PHP] uploading big files with PHP

2008-08-03 Thread brian

mike wrote:

On 7/25/08, Angelo Zanetti [EMAIL PROTECTED] wrote:

Hi all

We are pitching to develop a website where the admin has to upload big video
files but I'm not sure how this can be done as the file upload will most
probably time out.

How do current websites do it? Is there somehow a way to make use of FTP to
transfer the files?

Any links, help, advice will be appreciated.

Thanks in advance


Use the PUT method
- requires webserver configuration to support it
- requires PHP to open the stream using php://input
- supports resuming (the client needs to give the script something
like ?offset=1234 and the PHP script needs to fseek() to that position
in the file)

Variety of options for uploading this way:
- anything that can leverage curl/libcurl
- browser plugins - lots of java ones, haven't found a flash one yet

Bonuses:
- Can run over ssl/https - since its just HTTP talking, so proxies are okay
- Can resume
- Doesn't require a two-step process for people to upload things (FTP,
SFTP to server, then go somewhere and associate the file, etc)

We'll be using this method we just wish there were nicer frontends,
most of the java ones are ugly as sin.

javauploader.com mentioned does not look like it supports PUT. however
I believe all of these do:

http://www.jfileupload.com/products/jfileupload/
http://www.radinks.com/upload/plus/resume.php
http://upload.thinfile.com/features.php



Also, use set_time_limit(0);


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



Re: [PHP] remembering where the user is on the page??

2008-08-03 Thread brian

Benjamin Hawkes-Lewis wrote:

brian wrote:
A better way to do that is to give some block element--a header, a 
div, etc.--an ID. That works exactly the same as a name=


It should work the same. But it doesn't in older user agents or with 
older assistive technology:


http://stevenclark.com.au/2008/07/11/named-anchors-and-skip-navigation/


I *suspect* that the a name= thing is deprecated, even.


Not in HTML:

http://www.w3.org/TR/REC-html40/struct/links.html#adef-name-A

It's deprecated in XHTML 1.0 (i.e. it's valid to use):

http://www.w3.org/TR/xhtml1/#h-4.10

It's removed in XHTML 1.1 (i.e. it's not valid to use):

http://www.w3.org/TR/xhtml11/changes.html#a_changes

Its removal from XHTML isn't particularly relevant to most web authors, 
as Trident (and hence both IE and older assistive technology that only 
supports IE) doesn't support XHTML except when served as text/html (i.e. 
tag soup), XHTML 1.0 has no advantages when served as tag soup, and 
XHTML 1.1 must not be served as text/html. ;)


--
Benjamin Hawkes-Lewis


Thanks for the info. I followed the first link to this other site that 
has a good run-down on some user-agent tests (note the ID i found for 
myself to provide easy navigation to the table ;-)


http://www.jimthatcher.com/skipnav.htm#skiptests

This table appears to show that there are few problems with using an ID 
on an existing element. Outside of IE6, that is. But then, we already 
knew that IE6 is broken.



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



Re: [PHP] PHP Memory Management

2008-08-03 Thread brian

Waynn Lue wrote:

I've been running the script below:

?php
  $appIds = getLotsOfAppIds();
  foreach ($appIds as $appId) {
echo $appId\n;
//echo memory_get_usage() . \n;
try {
  $getBundles = getBundles($appId);
  $numBundles = count($registeredBundles);
  echo $numBundles . \n;
  continue;
}
  }
?

And I get PHP Fatal Error: Allowed Memory Size Exhausted after it runs for a
bit.  Looking at the memory usage, it's because $getBundles (an array) is
huge, and keeps growing.  What I'm confused by is why setting it to
something else in the next iteration of the foreach loop doesn't free the
previously allocated array, since there shouldn't be any more references to
it.  I've worked around it by explicitly calling unset($getBundles), but
just wanted to understand why it's working the way it does.



Aside from on the 1st iteration, each time getBundles() is called, it 
creates an array within its own scope. Until PHP assigns the returned 
array to $getBundles, there are two in memory. Maybe that's the problem.


I don't know how you can stand naming structures or variables the same 
as functions, btw. That would drive me nuts. Where is this 
$registeredBundles coming from? Perhaps you meant:


$registeredBundles = getBundles($appId);

b

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



Re: [PHP] uploading big files with PHP

2008-08-03 Thread mike
On 8/3/08, brian [EMAIL PROTECTED] wrote:

 Also, use set_time_limit(0);

and configure the server and php to accept a decent size, and probably
configure the client to put only chunks at a time right?

otherwise php will hit it's memory limit for the script quite easily i
would assume. so there has to be something that allows it to stream
and keep only so much in the buffer at a time.

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



Re: [PHP] PHP Memory Management

2008-08-03 Thread Chacha C
is it possible because you can assign $func = foo and call $func() and it
will call foo(), maybe that its creating an endless loop of assigning the
function to itself?

On Sun, Aug 3, 2008 at 11:17 AM, brian [EMAIL PROTECTED] wrote:

 Waynn Lue wrote:

 I've been running the script below:

 ?php
  $appIds = getLotsOfAppIds();
  foreach ($appIds as $appId) {
echo $appId\n;
//echo memory_get_usage() . \n;
try {
  $getBundles = getBundles($appId);
  $numBundles = count($registeredBundles);
  echo $numBundles . \n;
  continue;
}
  }
 ?

 And I get PHP Fatal Error: Allowed Memory Size Exhausted after it runs for
 a
 bit.  Looking at the memory usage, it's because $getBundles (an array) is
 huge, and keeps growing.  What I'm confused by is why setting it to
 something else in the next iteration of the foreach loop doesn't free the
 previously allocated array, since there shouldn't be any more references
 to
 it.  I've worked around it by explicitly calling unset($getBundles), but
 just wanted to understand why it's working the way it does.


 Aside from on the 1st iteration, each time getBundles() is called, it
 creates an array within its own scope. Until PHP assigns the returned array
 to $getBundles, there are two in memory. Maybe that's the problem.

 I don't know how you can stand naming structures or variables the same as
 functions, btw. That would drive me nuts. Where is this $registeredBundles
 coming from? Perhaps you meant:

 $registeredBundles = getBundles($appId);

 b

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




-- 
http://twit.tv
- What I listen to All Week


[PHP] [PHP Header] Right-Click Download in Firefox showing php filename

2008-08-03 Thread Will
I followed some of the examples that was on PHP header()
http://us3.php.net/manual/en/function.header.php

I am trying to have users download a file named 'Setup.msi', however
under a PHP file with the sent header information, the default name to
the user will be 'ApplicationSetup_v1_0.msi' -- I am sending the
recommended header information in the notes. For example in my
'download.php':

$forcename = ApplicationSetup_v1_0.msi;
$filename = Setup.msi;

header(Content-Type: application/force-download);
header(Content-Type: application/octet-stream; name=.$forcename);
header(Content-Type: application/octetstream; name=.$forcename);
header(Content-Transfer-Encoding: binary);
header(Content-Length: .filesize($filename));

@readfile($filename);


When I LEFT-CLICK the 'download.php' link in Internet Explorer 6/7 and
Firefox 2/3, it defaults the download name to the variable that I want
it changed to ($forcename). When I RIGHT-CLICK in Internet Explorer
6/7, it also works. However when I RIGHT-CLICK the link in Firefox
2/3, it downloads the file as 'download.php' and not the specified
name and .msi extension (I can still rename to the .msi extension and
it works fine). Am I missing another header or is there known issue
for Firefox right-click Save Link As... and default the name to
something else? Or should I contact Firefox on this to get more
information to default the name to something different?

Thanks


-- 
William Frankhouser
WilzDezign
http://www.wilzdezign.com

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



RE: [PHP] uploading big files with PHP

2008-08-03 Thread Catalin Zamfir Alexandru | KIT Software CAZ
What are you talking about? I've been able to upload a 4GB file without 
problem. Uploading doesn't depend on memory limit, and this has been a subject 
of debate on the PHP.net Manual (uploading files section, check it out).

-Original Message-
From: mike [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 04, 2008 4:07 AM
To: brian
Cc: php-general@lists.php.net
Subject: Re: [PHP] uploading big files with PHP

On 8/3/08, brian [EMAIL PROTECTED] wrote:

 Also, use set_time_limit(0);

and configure the server and php to accept a decent size, and probably
configure the client to put only chunks at a time right?

otherwise php will hit it's memory limit for the script quite easily i
would assume. so there has to be something that allows it to stream
and keep only so much in the buffer at a time.

-- 
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] PDO prepared statements and LIKE escaping

2008-08-03 Thread Larry Garfield
Hi folks.  I am trying to figure out the best way to handle an interesting 
issue in PDO prepared statements.  Consider:

$search = 'mystring';

$stmt = $dbh-prepare(SELECT * FROM mytable WHERE myfield LIKE :myfield);
$stmt-execute(array(':myfield' = $search . '%'));

The above will search for any record whose myfield entry begins with the value 
in $search.  Great.  And because it's a prepared statement, the database 
handles SQL injection protection for us.

According to the manual, that is the correct way of handling LIKE statements:

http://us3.php.net/manual/en/pdo.prepared-statements.php

(See Example #6)

But!  Now consider this:

$search = 100% pure PHP;

When that is run, the % in the literal string will get interpreted by the SQL 
server as another wildcard character.  That is not desired.

IIRC, the way in SQL to circumvent that is to convert 100% into 100%%.  
However, that does rather defeat the purpose of a prepared statement if I 
have to do my own escaping anyway, does it not?  We also cannot use 
$dbh-quote(), as that is intended for cases where you're building a query 
string directly rather than using a prepared statement.

How do other folks handle this issue?

-- 
Larry Garfield
[EMAIL PROTECTED]

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