OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 19 Aug 2005 20:18:31 -0000 Issue 3634

php-general-digest-helplists.php.net
Date: Fri Aug 19 2005 - 15:18:31 CDT


php-general Digest 19 Aug 2005 20:18:31 -0000 Issue 3634

Topics (messages 220926 through 220975):

setting 'sendmail_from' on windows
        220926 by: George Pitcher
        220928 by: Mark Rees
        220930 by: George Pitcher
        220936 by: George Pitcher

Re: Catching all errors and redirecting
        220927 by: Mark Rees
        220929 by: Norbert Wenzel

Re: php 5.04 register_globals aint acting right.
        220931 by: Jochem Maas

Re: 'God' has spoken... :-)
        220932 by: Jochem Maas
        220975 by: Dotan Cohen

Problem mit PEAR-Package Log
        220933 by: Sabine

Re: Differences with imap_headerinfo() between PHP 4.3.11 and 4.4.0?
        220934 by: Mike Walsh

Re: clearing cache contents
        220935 by: Jay Blanchard

Re: Catching all errors and redirecting O T
        220937 by: Jay Blanchard
        220945 by: John Nichel

Unique user?
        220938 by: Gustav Wiberg
        220941 by: Jay Blanchard
        220950 by: Jason Barnett
        220970 by: A.W. Wright

Re: previous + next buttons, no DB
        220939 by: Jim Moseby
        220958 by: Ashley M. Kirchner

[really O T] Re: [PHP] Catching all errors and redirecting O T
        220940 by: Jochem Maas

upload large files troubles
        220942 by: curipin
        220943 by: Jay Blanchard
        220944 by: Jay Blanchard
        220949 by: Jay Blanchard

Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] Install PHP in Linux
        220946 by: John Nichel

Re: preg_match
        220947 by: John Nichel
        220948 by: John Nichel
        220954 by: Matthew Weier O'Phinney

Re: is it worth using apache2 with php 4.3.4
        220951 by: Matthew Weier O'Phinney
        220953 by: John Nichel
        220971 by: A.W. Wright

Re: PHP MySQL insert
        220952 by: Ben Ramsey
        220974 by: areguera

Re: ob_start changed from php4 to php5?
        220955 by: Marten Lehmann

Re: How to show complete exception text?
        220956 by: Christopher J. Bottaro

Call to Static Method PHP5
        220957 by: Adrian Cid Almaguer
        220960 by: M. Sokolewicz

Re: Week Days
        220959 by: Jordan Miller
        220962 by: Robert Cummings
        220966 by: Philip Hallstrom
        220967 by: Robert Cummings
        220968 by: Robert Cummings
        220969 by: Philip Hallstrom

Error checking on file upload
        220961 by: Peppy
        220963 by: Steve Slotnick
        220964 by: Steve Slotnick
        220965 by: Peppy

Re: php-windows Digest 19 Aug 2005 19:00:33 -0000 Issue 2754
        220972 by: JM

Question about Windows Installation
        220973 by: JM

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Hi,

I am sending emails out from php using a variety of 'From addresses',
depending on who is logged on. I would like bounced messages to go directly
to the sender, but they are not. I suspect that this is because in php.ini,
I have to set the 'sendmail_from' to a specific address.

Can anyone suggest an alternative, other than switching platforms?

MTIA

George

attached mail follows:


""George Pitcher"" <george.pitcheringenta.com> wrote in message
news:AMEPJAJDOFCDLPGFDOIFCEHIHGAA.george.pitcheringenta.com...
> Hi,
>
> I am sending emails out from php using a variety of 'From addresses',
> depending on who is logged on. I would like bounced messages to go
directly
> to the sender, but they are not. I suspect that this is because in
php.ini,
> I have to set the 'sendmail_from' to a specific address.
>

I don't know if this will work, but try using ini_set to change
sendmail_from as necessary

http://uk2.php.net/manual/en/function.ini-set.php

List of ini options here

http://uk2.php.net/manual/en/ini.php#ini.list

> Can anyone suggest an alternative, other than switching platforms?
>
> MTIA
>
>
> George

attached mail follows:


Mark,

Thanks, I'll have a look at that over the weekend.

Cheers

George

> -----Original Message-----
> From: Mark Rees [mailto:mreesitsagoodprice.com]
> Sent: 19 August 2005 9:42 am
> To: php-generallists.php.net
> Subject: [PHP] Re: setting 'sendmail_from' on windows
>
>
> ""George Pitcher"" <george.pitcheringenta.com> wrote in message
> news:AMEPJAJDOFCDLPGFDOIFCEHIHGAA.george.pitcheringenta.com...
> > Hi,
> >
> > I am sending emails out from php using a variety of 'From addresses',
> > depending on who is logged on. I would like bounced messages to go
> directly
> > to the sender, but they are not. I suspect that this is because in
> php.ini,
> > I have to set the 'sendmail_from' to a specific address.
> >
>
> I don't know if this will work, but try using ini_set to change
> sendmail_from as necessary
>
> http://uk2.php.net/manual/en/function.ini-set.php
>
> List of ini options here
>
> http://uk2.php.net/manual/en/ini.php#ini.list
>
>
> > Can anyone suggest an alternative, other than switching platforms?
> >
> > MTIA
> >
> >
> > George
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Mark,

Just to let you know that it did the trick.

Cheers

George

> -----Original Message-----
> From: Mark Rees [mailto:mreesitsagoodprice.com]
> Sent: 19 August 2005 9:42 am
> To: php-generallists.php.net
> Subject: [PHP] Re: setting 'sendmail_from' on windows
>
>
> ""George Pitcher"" <george.pitcheringenta.com> wrote in message
> news:AMEPJAJDOFCDLPGFDOIFCEHIHGAA.george.pitcheringenta.com...
> > Hi,
> >
> > I am sending emails out from php using a variety of 'From addresses',
> > depending on who is logged on. I would like bounced messages to go
> directly
> > to the sender, but they are not. I suspect that this is because in
> php.ini,
> > I have to set the 'sendmail_from' to a specific address.
> >
>
> I don't know if this will work, but try using ini_set to change
> sendmail_from as necessary
>
> http://uk2.php.net/manual/en/function.ini-set.php
>
> List of ini options here
>
> http://uk2.php.net/manual/en/ini.php#ini.list
>
>
> > Can anyone suggest an alternative, other than switching platforms?
> >
> > MTIA
> >
> >
> > George
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


""Jay Blanchard"" <jay.blanchardniicommunications.com> wrote in message
news:C8F323573C030A448F3E5A2B6FE2070B08EB97C7nemesis...
[snip]
Is it possible to catch all parser errors (notices), and as that happens
redirecting to a 'sorry-page-not-available-at-this-moment' page, whilst
storing the error (or notice) message somewhere else (e.g. emailing it
to
the developer).
[/snip]

Yes?

/subtle

What is the point of taking this attitude with a poster who (I'm guessing
from his name) is a non-native English speaker? He asks a perfectly polite,
intelligible and on-topic question. Even if he isn't a good proportion of
posters are non-native speakers, and I imagine they find this kind of thing
a little intimidating.

One strange thing I notice about this list: even the most off-topic and
misguided question (like how can I clear a user's browser cache with PHP,
how do I set up a mailserver) gets a few intemperate answers and then
(perhaps because people's attention is drawn to it) a series of useful
answers. This encourages posters to come back and ask again, as they keep
getting answers. A well-formulated question, on the other hand, will
sometimes just be ignored, perhaps because it is buried in the general
traffic. Witness the recent post by Richard Lynch on "True Upload Max
Filesize", for example.

attached mail follows:


Thomas Hochstetter wrote:
> Hi again,
>
> Is it possible to catch all parser errors (notices), and as that happens
> redirecting to a 'sorry-page-not-available-at-this-moment' page, whilst
> storing the error (or notice) message somewhere else (e.g. emailing it to
> the developer).
>
> thanks
>
> Thomas

 From your name I would say you are german speaking, so i would suggest
the error_handler example from the book

        Professionelle PHP 5-Programmmierung
        Entwicklerleitfaden für große Webprojekte mit PHP 5
        von George Schlossnagle
        
        erschienen in der Open-Source-Library des Addison-Wesley Verlag
        ISBN: 3-8273-2198-0

Examples to this book [1] can be found under [2], the example to your
special problem would be example 3-1.

I'm sorry for writing german, but since it's a german book, i wrote all
the facts about the book in german.

Norbert

[1]
http://www.addison-wesley.de/main/main.asp?page=deutsch/bookdetails&productid=83009
[2]
http://www.awl.de/buecher/3827321980/?SID={FC2DF695-9416-4CE0-8077-877C84150EF1}

attached mail follows:


Richard Lynch wrote:
> On Wed, August 17, 2005 5:21 am, Jochem Maas wrote:
>
>>Daniel Baughman wrote:
>>
>>>Its simply a Boolean to indicate whether or not a query should be
>>>ran and
>>>displayed, and further more its for a small intranet.
>
>
> If it's that small a project/program, it should not be that tricky to
> find the variable that needs to change from $foo to $_POST['foo']
>
>
>>>Register_globals is the directive I meant to say. But your right
>>>about
>>>globals. Some applications haven't made that change yet... So
>>
>>stick this in a auto_prepend_file (or at the top of a global include:
>>
>><?
>>extract($_REQUEST);
>>?>
>>
>>crude, but not exactly a rewrite.
>
>
> You might as well just turn register_globals "on"
>
> Because this has ALL the problems of register_globals.

bar 1. namely the problem of not upgrading to recent version of php (i.e.
something beginning with 5 ;-) because 'my code will break'.

I don't think upgrading and then turning on the ini setting is a good idea...
the legacy app is a problem by definition because it uses register globals, but
that doesn't mean one has to keep that door open for new apps, besides changing
ini settings, at least having an app rely on the changes, from the default leads
to less portable code.

>
> Only maybe slightly slower, since it's wrapped up in a PHP function call.
>
> extract($_REQUEST) is like installing a deadbolt on your door, and
> then leaving the key in it at all times.

true. I was just pointing out how easy it is to 'fake' register_globals
personally all my code currently runs this on init - because I don't
like reg.globals at all:

function unRegisterGlobals()
{
     if (ini_get('register_globals')) {
         $SGs = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET);
         if (isset($_SESSION)) { array_unshift($SGs, $_SESSION); }

         foreach ($SGs as $sg) {
             foreach ($superglobal as $k => $v) { unset($GLOBALS[ $k ]); }
         }

         ini_set('register_globals', false);
     }
}

>

attached mail follows:


Richard Lynch wrote:
> On Wed, August 17, 2005 2:05 am, Dotan Cohen wrote:
>
>>On 8/15/05, Miles Thompson <milesallnovascotia.com> wrote:
>>
>>>The problem with PHP 5 is that the ISP's have to be so conservative.
>>>There's no tagging mechanism which says "process these files with
>>>PHP5, use
>>>PHP 4 for everything else."
>>>
>>
>>Does anyone here remember that on php 3 the file extensions were
>>.php3? That made moving to php4 easy- files ending in .php3 was parsed
>>as 3, and files ending in .php were parsed as 4. Why not do something
>>similar when moving to 5 or 6?
>
>
> The .php3 extension was more of a pain in the ass than it saved...
>
> It was also possible to compile PHP3 and PHP4 in the same Apache - I
> do not think you can do that with 4/5.
>
> However, Rasmus posted a lovely explanation in this forum for EXACTLY
> how to have both 4 & 5 running on the same box.
>
> Search for "Rasmus Lerdorf" and "proxy server" and it should come up.
>
> Maybe like 3 or 4 months ago?

actually he posted (an update?) a full on explanation (again!) just 5 days
ago (on the 14th August 2005) on how to do it in reply to this thread!

and he makes it sound so easy :-)

>

attached mail follows:


On 8/19/05, Jochem Maas <jochemiamjochem.com> wrote:
> actually he posted (an update?) a full on explanation (again!) just 5 days
> ago (on the 14th August 2005) on how to do it in reply to this thread!
I had to read your post twice to understand to which _he_ you are
referring. Then I reread the subject (You are the OP, Jochem, right?)
and figured it out.

>
> and he makes it sound so easy :-)
Well, that's how he got the single-quoted title, no?

Dotan
http://lyricslist.com/lyrics/artist_albums/167/doors.php
The Doors Song Lyrics

attached mail follows:


Hello to all,

I want to use the PEAR-package Log (now on 4.3.10).
I just have a few lines of code, copied from the documentation.
And always, that means with every logger I tried, get "Call to undefined
function"-errors.
I can't see what ist that wrong.
Has anybody else an idea?

I just installed the package like I did with Mail_Queue and
Text_Password which worked fine.

Here is my code:

<script>
require_once('./inc_pear.php');
require_once('PEAR.php');
require_once('Log.php');

$conf = array('title' => 'Sample Log Output');
$logger = &Log::singleton('win', 'LogWindow', 'ident', $conf);
</script>

--> Fatal error: Call to undefined function: upto() in
/mypearpath/PEAR/Log/win.php on line 78

The same with display.

With the file-logger, I can instantiate it, but get a undefined function
later.
<script>
$opts = array( 'append' => true,
              'lineFormat' => '%{ident}; %{timestamp}; %{priority};
%{message}',
              'timeFormat' => '%d.%m.%Y %H:%M:%s'
            );

$logger = &LOG::factory('file', './../files/logtest.txt', 'wat dat?');
$logger->open();
$res = $logger->getMask();
</script>

-->Fatal error: Call to undefined function: getmask() in
/myscriptpath/logger.php on line 48

Thank you very much in advance
Sabine

attached mail follows:


""Richard Lynch"" <ceol-i-e.com> wrote in message
news:48331.67.167.5.210.1124352495.squirrelwww.l-i-e.com...
>
> Wrapping ob_start() / ob_get_contents() / ob_end_clean() around the
> IMAP calls MIGHT let you catch the output and throw it away...
>
>

That is a good idea, I will give that a shot.

Thanks,

Mike

--
Mike Walsh - mike_walsh at mindspring.com

attached mail follows:


[snip]
 can anyone provide me a solution for clearing the
cache contents on the clientside using javascript.
[/snip]

1. Go to http://www.google.com
2. Type in JavaScript mailing lists
3. join one
4. Ask this question there.

attached mail follows:


[snip]
What is the point of taking this attitude with a poster who (I'm
guessing
from his name) is a non-native English speaker? He asks a perfectly
polite,
intelligible and on-topic question. Even if he isn't a good proportion
of
posters are non-native speakers, and I imagine they find this kind of
thing
a little intimidating.
[/snip]

Yes, I suppose your are correct. His english was remarkably well written
so I did not suspect that he was foreign and I didn't even look at the
e-mail address for the reply.

The point is this, as more and more folks take to mailing lists such as
this there are good practices and bad practices. We all need to learn
good practices, like avoiding top-posting.

You have exercized your right to point out what may be a bad practice,
me answering the OP in a sarcastic tone is a bad thing. You taking me on
for same is a bad thing, especially when you do not mark the subject as
now being off topic, such as I have done. How long have you been mailing
to mailing lists?

I suppose that the good old days are long gone. The ones where newbies
were whipped into shape with just a few keystrokes. I guess we need to
be more politically correct and sensitive to the needs of others now. In
the spirit of this I will refrain from answering the "is it possible"
questions. Heck I may not answer any others either as my old school
cumrudgeonly attitude may be too much for others, especially those folks
who do not hail from english speaking countries.

My apologies to any and all who were offended by my curt response.

attached mail follows:


Jay Blanchard wrote:
<snip>
> I suppose that the good old days are long gone. The ones where newbies
> were whipped into shape with just a few keystrokes. I guess we need to
> be more politically correct and sensitive to the needs of others now. In
> the spirit of this I will refrain from answering the "is it possible"
> questions. Heck I may not answer any others either as my old school
> cumrudgeonly attitude may be too much for others, especially those folks
> who do not hail from english speaking countries.

When I become ruler of the world, I'm going to outlaw political correctness.

>
> My apologies to any and all who were offended by my curt response.
>

It's your curt smell that offends me. ;)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Hi there!

Is there any way of doing this:

1. User may vote 1-10 on a joke on a site X.
2. Same User may NOT vote again dependent of the computer...

I know this works if I check IP-adress, but because some users doesn't have
a fixed ip-adress... it won't work correct.

Thought of getting a mac-adress, but I think is impossible to... :-)

Any ideas?

/G
varupiraten.se

attached mail follows:


[snip]
Is there any way of doing this:

1. User may vote 1-10 on a joke on a site X.
2. Same User may NOT vote again dependent of the computer...

I know this works if I check IP-adress, but because some users doesn't
have
a fixed ip-adress... it won't work correct.

Thought of getting a mac-adress, but I think is impossible to... :-)

Any ideas?
[/snip]

Why not set a cookie? Now, we all know that users can delete
cookies...but they typically do not do so. You could also make them
register to be able to vote. That way they have to login before they
vote and the vote would be tracked by username. They could register
multiple names, but again they are not likely to do so.

attached mail follows:


I'm going to agree with Jay... most users are lazy enough that if you
just require them to have a user account then that will suffice.
Since this is only for a joke site that would be my suggestion as
well. However, if you really, really wanted to identify remote
*computers* then you can try tracking the clock skew of the client
which is making that request. If you're interested then google for
"clock skew tracking" and you should get some hits.

attached mail follows:


Gustav Wiberg wrote:
> Hi there!
>
> Is there any way of doing this:
>
> 1. User may vote 1-10 on a joke on a site X.
> 2. Same User may NOT vote again dependent of the computer...
>
> I know this works if I check IP-adress, but because some users doesn't
> have a fixed ip-adress... it won't work correct.
>
> Thought of getting a mac-adress, but I think is impossible to... :-)
>
> Any ideas?
>
> /G
> varupiraten.se

 From slashdot.org (1):

* Don't complain about lack of options. You've got to pick a few when
you do multiple choice. Those are the breaks.
* Feel free to suggest poll ideas if you're feeling creative. I'd
strongly suggest reading the past polls first.
* This whole thing is wildly inaccurate. Rounding errors, ballot
stuffers, dynamic IPs, firewalls. If you're using these numbers to do
anything important, you're insane.

(1): "http://slashdot.org/pollBooth.pl?qid=1304&aid=-1" is one address

attached mail follows:


> Say the images are in a folder called /gallery/
>
> Within that, I have an index.php that is manually coded to have
> thumbnails of the images displayed in a grid. Important to note:
> they're in a very specific (artistic) order. Each one of those
> thumbnails is linked to one and the same popup.php file that
> is simply
> another php file that expects an $ID passed to it. That $ID, which
> again is hard coded in index.html, tells popup.php which file to
> display. (that $ID is basically the file name of the image, so I can
> append it to the <img /> tag as the page loads.
>
> So you see, I have no array of anything. The index.html
> file gets
> manually edited every time something is added or removed.
> This is why
> I'd like a programmatic way of a) generating that file, so that the
> client can add/remove images as they see fit, and b) be able to have
> prev/next buttons on the popup window.
>

Ashley,

If you use a naming convention for the files in /gallery/ that coincides
with the artistic order in which they are to be displayed, then Greg's
simple (yet elegant, and expertly coded) directory listing method would work
like a charm.

Say your files are named like this:

100.jpg // 1st file to be displayed
200.jpg // 2nd file...
300.jpg // 3rd file...
...

Using Greg's code, you could pull the enitire directory into an array:

$a = array();
$d = dir( '.' );
while( false !== ( $e = $d->read() ) )
{
  $a[] = $e;
}
$d->close();

Since you now know which picture you are currently displaying, you can get
the previous and next pictures from the array and code your "Next" and
"Previous" buttons. If the pic you are displaying happens to be the first
or last in the array, don't display the corresponding link.

Of course, this all depends on your naming convention agreeing with your
display order.

JM

attached mail follows:


Jim Moseby wrote:

>If you use a naming convention for the files in /gallery/ that coincides
>with the artistic order in which they are to be displayed, then Greg's
>simple (yet elegant, and expertly coded) directory listing method would work
>like a charm.
>
>
    Unfortunately, they're not. This might work for the first
incarnation of the gallery, but as soon as they start removing and
adding images, that numbered order goes to hell in a hand basket.
Imaging if they deleted #5 and in its place they want to add 4 new
images. Not going to work. No, the images are all named by the picture
name, such_n_such_mountain, this_beach, small_flower, blah, blah, blah.

--
H | I haven't lost my mind; it's backed up on tape somewhere.
  +--------------------------------------------------------------------
  Ashley M. Kirchner <mailto:ashleypcraft.com> . 303.442.6410 x130
  IT Director / SysAdmin / WebSmith . 800.441.3873 x130
  Photo Craft Imaging . 3550 Arapahoe Ave. #6
  http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.

attached mail follows:


Jay Blanchard wrote:
> [snip]
> What is the point of taking this attitude with a poster who (I'm
> guessing
> from his name) is a non-native English speaker? He asks a perfectly
> polite,
> intelligible and on-topic question. Even if he isn't a good proportion
> of

the question was VAGUE ... this is IT not sociology ...
questions that start 'is it possible' are pretty much asking for a 'yes.'
or a 'maybe.'

if the OP takes the hint and develops his ability to succinctly ask questions
(one that don't implicitly ask someone else to provide a complete solution to
a very general problem!!) then everyone benefits - him most of all.

besides getting the equivelant of a RTFM is kinding telling the OP, your
not a total noob anymore, time to fend for yourself - he could take it as a compliment ;-).

> posters are non-native speakers, and I imagine they find this kind of
> thing
> a little intimidating.

I know people who find it intimidating to sit in a room alone or go to
the supermarket. feeling intimidated is a state of mind but not anyone's
intention here (AFAICT)

> [/snip]
>
> Yes, I suppose your are correct. His english was remarkably well written
> so I did not suspect that he was foreign and I didn't even look at the
> e-mail address for the reply.

the guy is german - most germans speak/write better english people do.
just like they build better cars. ;-) so no pity for [male] germans. :-P

        _only joking_

> The point is this, as more and more folks take to mailing lists such as
> this there are good practices and bad practices. We all need to learn
> good practices, like avoiding top-posting.
>
> You have exercized your right to point out what may be a bad practice,
> me answering the OP in a sarcastic tone is a bad thing. You taking me on
> for same is a bad thing, especially when you do not mark the subject as
> now being off topic, such as I have done. How long have you been mailing
> to mailing lists?
>
> I suppose that the good old days are long gone. The ones where newbies
> were whipped into shape with just a few keystrokes. I guess we need to

keep wipin' Jay! - they love you for it in the end :-) besides there is lots
of work to do if we want to drag the masses forward (e.g. praise the day that
there will be no more questions regarding register_globals!)

> be more politically correct and sensitive to the needs of others now. In
> the spirit of this I will refrain from answering the "is it possible"
> questions. Heck I may not answer any others either as my old school
> cumrudgeonly attitude may be too much for others, especially those folks
> who do not hail from english speaking countries.

now look what you have done Mark!

>
> My apologies to any and all who were offended by my curt response.

since when are you called Curt? ;-)

>

attached mail follows:


  hi!

I have apache2 + php5. I need to upload large files. I found out, that
file is uploaded always. But:
- if the file is less than 167 MB all is OK, then I tryed larger files -
from 191 MB up, files are uploaded, but php script, which handle the
operation is "like" not executed. I always get blank (clear) page (f.e.
echo "hello"; does not work!), so I can not let users know, that upload
finished OK.
Here is part of my php.ini file:
max_execution_time = 70000
max_input_time = 70000
memory_limit = 16M
post_max_size = 900M
upload_max_filesize = 900M
default_socket_timeout = 80000
....I think, these are all interested parts in this problem.
Thanks.

attached mail follows:


[snip]
I have apache2 + php5. I need to upload large files. I found out, that
file is uploaded always. But:
- if the file is less than 167 MB all is OK, then I tryed larger files -

from 191 MB up, files are uploaded, but php script, which handle the
operation is "like" not executed. I always get blank (clear) page (f.e.
echo "hello"; does not work!), so I can not let users know, that upload
finished OK.
Here is part of my php.ini file:
max_execution_time = 70000
max_input_time = 70000
memory_limit = 16M
post_max_size = 900M
upload_max_filesize = 900M
default_socket_timeout = 80000
....I think, these are all interested parts in this problem.
[/snip]

In your file where you browse for files to upload does it look like
this?

<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="__URL__" method="POST">
    <!-- MAX_FILE_SIZE must precede the file input field -->
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
    <!-- Name of input element determines name in $_FILES array -->
    Send this file: <input name="userfile" type="file" />
    <input type="submit" value="Send File" />
</form>

attached mail follows:


[snip]
Sure, it looks:
<form enctype="multipart/form-data" action="upload.php" method="post">
                <input type="hidden" name="MAX_FILE_SIZE"
value="1000000000" />
                <input type="file" name="f" size="30" /><br>
                <input type="submit" name="Send">

all works great, to 160 MB, larger files are uploaded but php script not

  executed. Hmm.
[/snip]

Then can you send us the code from the processing script? That way we
may see where it fails.

attached mail follows:


MAKE SURE TO HIT REPLY-ALL SO THAT THE MESSAGE GETS BACK TO THE LIST

[snip]
The code is pretty simple, i do not think, problem is bad syntax, as I
said, everything works fine, when files are smaller then 160 MB. Larger
files = blank page.

<?php

if(isset($_FILES['f']))
{
     copy ($_FILES['f']['tmp_name'], "Uploaded filez/" .
$_FILES['f']['name'])
     or die ('Could not upload');
     echo "File: " . $_FILES['f']['name']. " uploaded!";
     echo "<p><a href='./index.html'>Back to upload</a>";
}
else
echo "Go away!";
?>
[/snip]

You need to read the manual on file uploads and use move_uploaded_file()
instead of copy... http://www.php.net/move_uploaded_file

attached mail follows:


Mario Lacunza wrote:
> Hello,
>
> Im newbie in Linux and I need your help for install PHP5 in my Ubuntu
> 5.04 Linux distro, any links, manuals, etc

How about a link _to_ *THE MANUAL*?

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

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Richard Lynch wrote:
> On Thu, August 18, 2005 2:50 pm, Jon wrote:
>
>>preg_match_all("/Charges \s\s+ $total x (.+) /siU", $single,
>>$from_invoice);
>
>
> I would recommend using \\s instead of \s -- While \s doesn't have any
> meaning in PHP strings, so PHP just figures you must have meant \\s
<snip>

But in perl type regex's, the \s is a space. Without testing it, I
don't think \\s would match what the OP was looking for (I *think* it
would match '\s'). However, I don't understand why the OP is looking
for a space " ", followed by a space "\s", followed by multiple spaces
"\s+"....a \s{1,} would have done all that just fine.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Jon wrote:
> preg_match_all("/Charges \s\s+ $total x (.+) /siU", $single, $from_invoice);

You'll probably need to assemble that expression first. The regex may
be seeing the dollar sign for your variable as an end of line delimiter.

$match = "/Charges\s{1,}" . $total . "\sx\s(.*)\s/siU";
preg_match_all ( $match, $single, $from_invoice );

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


* John Nichel <johnkegworks.com> :
> Richard Lynch wrote:
> > On Thu, August 18, 2005 2:50 pm, Jon wrote:
> > > preg_match_all("/Charges \s\s+ $total x (.+) /siU", $single,
> > > $from_invoice);
> >
> > I would recommend using \\s instead of \s -- While \s doesn't have any
> > meaning in PHP strings, so PHP just figures you must have meant \\s
> <snip>
>
> But in perl type regex's, the \s is a space. Without testing it, I
> don't think \\s would match what the OP was looking for (I *think* it
> would match '\s'). However, I don't understand why the OP is looking
> for a space " ", followed by a space "\s", followed by multiple spaces
> "\s+"....a \s{1,} would have done all that just fine.

But in double quotes, \ is seen as an escape, and could be interpreted
differently. Probably the better way to do this would be:

$pattern = '/Charges\s+' . $total . ' x ([^\s]*)/si';
preg_match_all($pattern, $single, $from_invoice);

--
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

attached mail follows:


* bala chandar <mbchandargmail.com>:
> i am now using apache 1.3.x with php 4.3.4
>
> is it worth upgrading to apache 2.x

Currently, no:

    http://ilia.ws/archives/32-Apache-1-vs-Apache-2-Performance.html

--
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

attached mail follows:


bala chandar wrote:
> Hi,
>
> i am now using apache 1.3.x with php 4.3.4
>
> is it worth upgrading to apache 2.x

That depends on your needs. Does Apache2 provide you with some
feature/functionality that Apache 1.3 does not?

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


bala chandar wrote:
> Hi,
>
> i am now using apache 1.3.x with php 4.3.4
>
> is it worth upgrading to apache 2.x

If it's not broken, don't fix it.

attached mail follows:


Please always reply to the list so that others can benefit from the
exchange. As it happens, I'm not exactly very knowledgeable about
character sets, so someone on the list may be able to offer more help
with regard to the problem you're experiencing.

-Ben

areguera wrote:
> On 8/19/05, Ben Ramsey <ramseyphp.net> wrote:
>
>>Alain Reguera Delgado wrote:
>>
>>>you could try:
>>>
>>>1. get all form variables into an array
>>
>>fine
>>
>>
>>>2. validate values
>>
>>Good, but do this step as you put the values into a separate array,
>>don't put all the values into the array first and then validate them
>>later... make sure the input received is input expected and then save
>>only the input to the array that passes the validation/filtering tests
>
>
> yes .. that's much better .. :)
>
>
>>>3. convert all values into entities using htmlentities()
>>
>>Why do you want to do this before saving to the database?
>
>
> Ben, I got some troubles when moving database from one server to
> another, all Latin characters disappear, and the info turns a mess.
> Thought for a moment a server's language configuration setting. I was
> wondering by days to take this way, I thought if someone else wants
> the application and occurs the same because his configuration is not
> like mine. Then that solution came to me. Felt no matter what version
> or configuration of mysql or other db is used or what latin char is
> inserted, the data always be there for the web, in the language it
> speaks.
>
> This step has
>
>>absolutely no bearing on preparing the statement for insertion into a
>>database. It won't protect against SQL injection.
>
>
> Also, you will never
>
>>be able to do anything with this data other than use it for HTML output
>>(unless you try to reverse the entities, which seems like an awful lot
>>of work to me).
>
>
> yes, I don't like either...its not flexible.
>
> It's best to save the raw data as entered and escape it
>
>>(with htmlentities() or something else) ONLY on output.
>
>
> that was the first way I used to go... but after that problem, I am not sure
>
>
>>As I mentioned in my last post to this thread, the best way to escape a
>>string for insertion into a database (and protect against SQL injection)
>>is to use the escape function for the particular database --
>>mysql_real_escape_string() in this case. You should never use
>>htmlentities() to escape data before saving it to a database. Do that
>>only after you've pulled data from the database and are outputting it
>>somewhere (like on a Web page).
>>
>>
>>>4. build sql query (do some tests 'til get it right)
>>>5. execute the built query (with proper db function)
>>>
>>>by now, commas aren't a problem, they are limited between sql query's
>>>quotes. If some quotes are inserted as value they are previously
>>>converted to its entities and do not break the sql query.
>>
>>This is why you use mysql_real_escape_string(), etc. -- not htmlentities().
>>
>>
>>>as previously said in this thread, the problem is on quoting and maybe
>>>on converting the values to entities, to prevent some quote break the
>>>sql structure.
>>
>>You don't need to convert the values to HTML entities when saving to a
>>database. That's not going to prevent this problem.
>
>
> could you suggest something about Latin characters and portability?.
>
> Thanks for your time Ben. I am new in the list and in php too. Thanks
> for your answers.

attached mail follows:


sorry...here is the message

On 8/19/05, areguera <alain.regueragmail.com> wrote:
> On 8/19/05, Ben Ramsey <ramseyphp.net> wrote:
> > Alain Reguera Delgado wrote:
> > > you could try:
> > >
> > > 1. get all form variables into an array
> >
> > fine
> >
> > > 2. validate values
> >
> > Good, but do this step as you put the values into a separate array,
> > don't put all the values into the array first and then validate them
> > later... make sure the input received is input expected and then save
> > only the input to the array that passes the validation/filtering tests
>
> yes .. that's much better .. :)
>
> >
> > > 3. convert all values into entities using htmlentities()
> >
> > Why do you want to do this before saving to the database?
>
> Ben, I got some troubles when moving database from one server to
> another, all Latin characters disappear, and the info turns a mess.
> Thought for a moment a server's language configuration setting. I was
> wondering by days to take this way, I thought if someone else wants
> the application and occurs the same because his configuration is not
> like mine. Then that solution came to me. Felt no matter what version
> or configuration of mysql or other db is used or what latin char is
> inserted, the data always be there for the web, in the language it
> speaks.
>
> This step has
> > absolutely no bearing on preparing the statement for insertion into a
> > database. It won't protect against SQL injection.
>
> Also, you will never
> > be able to do anything with this data other than use it for HTML output
> > (unless you try to reverse the entities, which seems like an awful lot
> > of work to me).
>
> yes, I don't like either...its not flexible.
>
> It's best to save the raw data as entered and escape it
> > (with htmlentities() or something else) ONLY on output.
>
> that was the first way I used to go... but after that problem, I am not sure
>
> >
> > As I mentioned in my last post to this thread, the best way to escape a
> > string for insertion into a database (and protect against SQL injection)
> > is to use the escape function for the particular database --
> > mysql_real_escape_string() in this case. You should never use
> > htmlentities() to escape data before saving it to a database. Do that
> > only after you've pulled data from the database and are outputting it
> > somewhere (like on a Web page).
> >
> > > 4. build sql query (do some tests 'til get it right)
> > > 5. execute the built query (with proper db function)
> > >
> > > by now, commas aren't a problem, they are limited between sql query's
> > > quotes. If some quotes are inserted as value they are previously
> > > converted to its entities and do not break the sql query.
> >
> > This is why you use mysql_real_escape_string(), etc. -- not htmlentities().
> >
> > > as previously said in this thread, the problem is on quoting and maybe
> > > on converting the values to entities, to prevent some quote break the
> > > sql structure.
> >
> > You don't need to convert the values to HTML entities when saving to a
> > database. That's not going to prevent this problem.
>
> could you suggest something about Latin characters and portability?.
>
> >
> > --
> > Ben Ramsey
> > http://benramsey.com/
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

attached mail follows:


Hello!

> I'm also guessing that it's the LAST line of the file with the
> "encodeDomain" function in it that you "include" in your test.php
>
> I'm also guessing that there's a NEWLINE character after the final ?>
> in that file on your 5.0.4 box, but that NEWLINE character is *NOT*
> there on your 4.0 box.

No, there are no newlines at the end of any files. The problem was a new
behavior of system() in PHP5:

"The system() call also tries to automatically flush the web server's
output buffer after each line of output if PHP is running as a server
module."

Obviously system() in PHP5 tries to flush, but because it's wrapped in
ob_start() end ob_end_clean(), it's doesn't actually do. Unfortunately
an interal flag in PHP is set to "output has been sent" anyway (bug?). I
first changed it to passthru() instead of system(), but maybe I should
use shell_exec() in the future.

Regards
Marten

attached mail follows:


Kevin Waterson wrote:

> This one time, at band camp, "Christopher J. Bottaro"
> <cjbottaroalumni.cs.utexas.edu> wrote:
>
>> Hi,
>>
>> When an exception propagates all the way up the stack frame and splatters
>> itself on my webpage, most of the text is cut off! This is completely
>> useless. I can see that there is an error, but I can't read the frickin
>> error message. How do I configure PHP to show the entire exception
>> message?
>
> not sure of your code, are you trying to do something like..
> <?php
>
> try {
> lots of good code;
> }
>
> catch(Exception $e){
> echo 'oh my, and exception has been thrown'.$e->getMessage();
> }
> ?>

No. The exception is not being caught and is propagating all the way up.
Then it is displayed on the webpage along with the call stack. The problem
is that a lot of the text is cut short so it will fit on the webpage
without word wrapping.
 
> Kevin

-- C

attached mail follows:


Hi:

I had the fallowing trouble while using a static method call on php5. Here's
my solution, i will really apreciate if anyone else can find another way
around..

The problem:

I have a fuction wich get a parameter that's an objetc, and that objetc
belongs to a class wich has a static method ( several class's may have the
same method, that's the reason for i never know for sure wich class the
objetc belongs to...) it has to be call inside the fuction... the solution i
found was:

<?
class Class1 {
static function do_static() { echo 'ok'; }
}

function use_static($object1) {
$class1 = get_class($object1);
$method = new ReflectionMethod($class1, 'do_static');
$method->invoke(null);
// First, I thinks do that
// $class1 = get_class($object1);
// $class1::do_static;
// But, I recieve an error

}

$object1 = new Class1;
use_static($object1);

?>

gretings

Adrian

attached mail follows:


how about using:
return call_user_func(array($object1, 'do_static'));

I've also modified your code so it works with both an object and a class:
<?php
class Class1 {
        static function do_static() {
                echo 'ok';
        }
}

function use_static($object1) {
        if(is_object($object1)) {
                $class = get_class($object1);
        } else {
                $class = $object1;
        }
        return call_user_func(array($class, 'do_static'));
}

use_static('Class1');
$obj = new Class1;
use_static($obj);
?>

Adrian Cid Almaguer wrote:
> Hi:
>
> I had the fallowing trouble while using a static method call on php5. Here's
> my solution, i will really apreciate if anyone else can find another way
> around..
>
> The problem:
>
> I have a fuction wich get a parameter that's an objetc, and that objetc
> belongs to a class wich has a static method ( several class's may have the
> same method, that's the reason for i never know for sure wich class the
> objetc belongs to...) it has to be call inside the fuction... the solution i
> found was:
>
> <?
> class Class1 {
> static function do_static() { echo 'ok'; }
> }
>
> function use_static($object1) {
> $class1 = get_class($object1);
> $method = new ReflectionMethod($class1, 'do_static');
> $method->invoke(null);
> // First, I thinks do that
> // $class1 = get_class($object1);
> // $class1::do_static;
> // But, I recieve an error
>
> }
>
> $object1 = new Class1;
> use_static($object1);
>
> ?>
>
> gretings
>
> Adrian
>

attached mail follows:


Yo,

All you need is the mktime() command.

do something like:
$futureDate = date("Y-m-d", mktime(0, 0, 0, $month, $today+
$daysToAdd, $year));

Jordan

http://www.php.net/mktime
mktime() is useful for doing date arithmetic and validation, as it
will automatically calculate the correct value for out-of-range
input. For example, each of the following lines produces the string
"Jan-01-1998".

<?php
echo date("M-d-Y", mktime(0, 0, 0, 12, 32, 1997));
echo date("M-d-Y", mktime(0, 0, 0, 13, 1, 1997));
echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 1998));
echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 98));
?>

On Aug 19, 2005, at 12:57 AM, benc11gmail.com wrote:

> I am trying to add 3 (or a user-defined amount) week days to a
> certain date..
> An example is today 2005-08-18 then adding 3 week days to give me a
> date of
> 2005-08-23. I have tried searching online but cannot find an easy
> way of
> doing so.
>

attached mail follows:


On Fri, 2005-08-19 at 11:17, Jordan Miller wrote:
> Yo,
>
> All you need is the mktime() command.
>
> do something like:
> $futureDate = date("Y-m-d", mktime(0, 0, 0, $month, $today+
> $daysToAdd, $year));
>
> Jordan
>
>
> http://www.php.net/mktime
> mktime() is useful for doing date arithmetic and validation, as it
> will automatically calculate the correct value for out-of-range
> input. For example, each of the following lines produces the string
> "Jan-01-1998".
>
> <?php
> echo date("M-d-Y", mktime(0, 0, 0, 12, 32, 1997));
> echo date("M-d-Y", mktime(0, 0, 0, 13, 1, 1997));
> echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 1998));
> echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 98));
> ?>

All fine and dandy... but he said WEEKDAYS, so adding 5 days to a given
day must non deduct from the 5 days when a weekend day is passed. This
kind of calculation is useful for banks and other businesses that only
process transactions on business days (which happen to be weekdays).

Cheers,
Rob.

> On Aug 19, 2005, at 12:57 AM, benc11gmail.com wrote:
>
> > I am trying to add 3 (or a user-defined amount) week days to a
> > certain date..
> > An example is today 2005-08-18 then adding 3 week days to give me a
> > date of
> > 2005-08-23. I have tried searching online but cannot find an easy
> > way of
> > doing so.
> >
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


>> All you need is the mktime() command.
>>
>> do something like:
>> $futureDate = date("Y-m-d", mktime(0, 0, 0, $month, $today+
>> $daysToAdd, $year));
>>
>> Jordan
>>
>>
>> http://www.php.net/mktime
>> mktime() is useful for doing date arithmetic and validation, as it
>> will automatically calculate the correct value for out-of-range
>> input. For example, each of the following lines produces the string
>> "Jan-01-1998".
>>
>> <?php
>> echo date("M-d-Y", mktime(0, 0, 0, 12, 32, 1997));
>> echo date("M-d-Y", mktime(0, 0, 0, 13, 1, 1997));
>> echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 1998));
>> echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 98));
>> ?>
>
> All fine and dandy... but he said WEEKDAYS, so adding 5 days to a given
> day must non deduct from the 5 days when a weekend day is passed. This
> kind of calculation is useful for banks and other businesses that only
> process transactions on business days (which happen to be weekdays).

Easy enough to change that date(...mktime(...)) command above to return
the weekday and while the weekday is a weekend just add a day and repeat.

that would give you the next monday.

Holidays are another matter though, but that could be worked around as
well via a lookup table...

-philip

attached mail follows:


On Fri, 2005-08-19 at 13:47, Philip Hallstrom wrote:
> >> All you need is the mktime() command.
> >>
> >> do something like:
> >> $futureDate = date("Y-m-d", mktime(0, 0, 0, $month, $today+
> >> $daysToAdd, $year));
> >>
> >> Jordan
> >>
> >>
> >> http://www.php.net/mktime
> >> mktime() is useful for doing date arithmetic and validation, as it
> >> will automatically calculate the correct value for out-of-range
> >> input. For example, each of the following lines produces the string
> >> "Jan-01-1998".
> >>
> >> <?php
> >> echo date("M-d-Y", mktime(0, 0, 0, 12, 32, 1997));
> >> echo date("M-d-Y", mktime(0, 0, 0, 13, 1, 1997));
> >> echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 1998));
> >> echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 98));
> >> ?>
> >
> > All fine and dandy... but he said WEEKDAYS, so adding 5 days to a given
> > day must non deduct from the 5 days when a weekend day is passed. This
> > kind of calculation is useful for banks and other businesses that only
> > process transactions on business days (which happen to be weekdays).
>
> Easy enough to change that date(...mktime(...)) command above to return
> the weekday and while the weekday is a weekend just add a day and repeat

Well of course.. I already posted a full solution last night :) One
using the technique you describe above, which is a bad solution since it
requires the loop to run once for each day to add, and then another
solution which divides the problem into two subproblems which is MUCH
faster on larger sets of days to add.

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

attached mail follows:


On Fri, 2005-08-19 at 13:47, Philip Hallstrom wrote:
> >> All you need is the mktime() command.
> >>
> >> do something like:
> >> $futureDate = date("Y-m-d", mktime(0, 0, 0, $month, $today+
> >> $daysToAdd, $year));
> >>
> >> Jordan
> >>
> >>
> >> http://www.php.net/mktime
> >> mktime() is useful for doing date arithmetic and validation, as it
> >> will automatically calculate the correct value for out-of-range
> >> input. For example, each of the following lines produces the string
> >> "Jan-01-1998".
> >>
> >> <?php
> >> echo date("M-d-Y", mktime(0, 0, 0, 12, 32, 1997));
> >> echo date("M-d-Y", mktime(0, 0, 0, 13, 1, 1997));
> >> echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 1998));
> >> echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 98));
> >> ?>
> >
> > All fine and dandy... but he said WEEKDAYS, so adding 5 days to a given
> > day must non deduct from the 5 days when a weekend day is passed. This
> > kind of calculation is useful for banks and other businesses that only
> > process transactions on business days (which happen to be weekdays).
>
> Easy enough to change that date(...mktime(...)) command above to return
> the weekday and while the weekday is a weekend just add a day and repeat.

Actually sorry to post again on the same post, but this is like the
first solution posted and is invalid since it doesn't account for
non-weekdays that fall within the range. It only checks the endpoints of
the addition. For instance adding 50 days would contain about 20 or so
weekend days.

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

attached mail follows:


>> Easy enough to change that date(...mktime(...)) command above to return
>> the weekday and while the weekday is a weekend just add a day and repeat.
>
> Actually sorry to post again on the same post, but this is like the
> first solution posted and is invalid since it doesn't account for
> non-weekdays that fall within the range. It only checks the endpoints of
> the addition. For instance adding 50 days would contain about 20 or so
> weekend days.

Ah... but you are forgetting the rule I live by... anything that happened
more than a week ago or is happening more than a week in the future...
doesn't count, I don't remember, and I can't be held responsible for.

:-)

good catch though.

attached mail follows:


I've been working on a script for uploading a file to a Unix server. I'm testing the script and have it coded for error messages using a switch statement. One error that I am getting is case 2 "The file is bigger than this form allows" and I am wondering what might cause me to get the error for case 1 "The file is bigger than this PHP installation allows".

Thank you,
Althea

<form enctype="multipart/form-data" action="getfile.php" method="POST">
    <!-- MAX_FILE_SIZE must precede the file input field -->
    <input type="hidden" name="MAX_FILE_SIZE" value="50000" />
    
    <!-- Name of input element determines name in $_FILES array -->
    Send this file: <input name="userfile" type="file" />
    <br /><br />
    <input type="submit" value="Send File" />
</form>

---------------------------------------------
$uploaddir = '/home/httpd/vhosts/foxedge.net/httpdocs/lvs/phpclass/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
   echo "File is valid, and was successfully uploaded.\n";
} else {
   echo "Possible file upload attack!\n";
    switch ($_FILES['userfile'] ['error'])
         { case 1:
                   print '<p> The file is bigger than this PHP installation allows</p>';
                   break;
            case 2:
                   print '<p> The file is bigger than this form allows</p>';
                   break;
            case 3:
                   print '<p> Only part of the file was uploaded</p>';
                   break;
            case 4:
                   print '<p> No file was uploaded</p>';
                   break;
   
         }
}

echo 'Here is some more debugging info:';
print_r($_FILES);

echo "</pre>";

attached mail follows:


In your php.ini there are settings for "upload_max_filesize" and also
"post_max_size." These would be causes for case 2. More information:
http://us3.php.net/features.file-upload

On 8/19/05, Peppy < peppyfoxedge.net> wrote:
>
> I've been working on a script for uploading a file to a Unix server. I'm
> testing the script and have it coded for error messages using a switch
> statement. One error that I am getting is case 2 "The file is bigger than
> this form allows" and I am wondering what might cause me to get the error
> for case 1 "The file is bigger than this PHP installation allows".
>
> Thank you,
> Althea
>
>
> <form enctype="multipart/form-data" action="getfile.php" method="POST">
> <!-- MAX_FILE_SIZE must precede the file input field -->
> <input type="hidden" name="MAX_FILE_SIZE" value="50000" />
>
> <!-- Name of input element determines name in $_FILES array -->
> Send this file: <input name="userfile" type="file" />
> <br /><br />
> <input type="submit" value="Send File" />
> </form>
>
> ---------------------------------------------
> $uploaddir =
> '/home/httpd/vhosts/foxedge.net/httpdocs/lvs/phpclass/uploads/';
> $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
>
> echo '<pre>';
> if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
> echo "File is valid, and was successfully uploaded.\n";
> } else {
> echo "Possible file upload attack!\n";
> switch ($_FILES['userfile'] ['error'])
> { case 1:
> print '<p> The file is bigger than this PHP installation allows</p>';
> break;
> case 2:
> print '<p> The file is bigger than this form allows</p>';
> break;
> case 3:
> print '<p> Only part of the file was uploaded</p>';
> break;
> case 4:
> print '<p> No file was uploaded</p>';
> break;
>
> }
> }
>
> echo 'Here is some more debugging info:';
> print_r($_FILES);
>
> echo "</pre>";
>
>
>
>

attached mail follows:


Sorry, I meant case 1.

- Steve

On 8/19/05, Steve Slotnick <sslotnickgmail.com> wrote:
>
> In your php.ini there are settings for "upload_max_filesize" and also
> "post_max_size." These would be causes for case 2. More information:
> http://us3.php.net/features.file-upload
>
>
> On 8/19/05, Peppy < peppyfoxedge.net> wrote:
> >
> > I've been working on a script for uploading a file to a Unix server. I'm
> > testing the script and have it coded for error messages using a switch
> > statement. One error that I am getting is case 2 "The file is bigger than
> > this form allows" and I am wondering what might cause me to get the error
> > for case 1 "The file is bigger than this PHP installation allows".
> >
> > Thank you,
> > Althea
> >
> >
> > <form enctype="multipart/form-data" action="getfile.php" method="POST">
> > <!-- MAX_FILE_SIZE must precede the file input field -->
> > <input type="hidden" name="MAX_FILE_SIZE" value="50000" />
> >
> > <!-- Name of input element determines name in $_FILES array -->
> > Send this file: <input name="userfile" type="file" />
> > <br /><br />
> > <input type="submit" value="Send File" />
> > </form>
> >
> > ---------------------------------------------
> > $uploaddir =
> > '/home/httpd/vhosts/foxedge.net/httpdocs/lvs/phpclass/uploads/';
> > $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
> >
> > echo '<pre>';
> > if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
> > echo "File is valid, and was successfully uploaded.\n";
> > } else {
> > echo "Possible file upload attack!\n";
> > switch ($_FILES['userfile'] ['error'])
> > { case 1:
> > print '<p> The file is bigger than this PHP installation allows</p>';
> > break;
> > case 2:
> > print '<p> The file is bigger than this form allows</p>';
> > break;
> > case 3:
> > print '<p> Only part of the file was uploaded</p>';
> > break;
> > case 4:
> > print '<p> No file was uploaded</p>';
> > break;
> >
> > }
> > }
> >
> > echo 'Here is some more debugging info:';
> > print_r($_FILES);
> >
> > echo "</pre>";
> >
> >
> >
> >
>

attached mail follows:


Steve,

Thanks a bunch. Must have been "dead brain" today. I knew that as well as
could look it up using phpinfo().

Althea

>>In your php.ini there are settings for "upload_max_filesize" and also
"post_max_size." These would be causes for case 2. More information:
http://us3.php.net/features.file-upload

On 8/19/05, Peppy < peppyfoxedge.net> wrote:
>
> I've been working on a script for uploading a file to a Unix server. I'm
> testing the script and have it coded for error messages using a switch
> statement. One error that I am getting is case 2 "The file is bigger than
> this form allows" and I am wondering what might cause me to get the error
> for case 1 "The file is bigger than this PHP installation allows".
>
> Thank you,
> Althea
>
>
> <form enctype="multipart/form-data" action="getfile.php" method="POST">
> <!-- MAX_FILE_SIZE must precede the file input field -->
> <input type="hidden" name="MAX_FILE_SIZE" value="50000" />
>
> <!-- Name of input element determines name in $_FILES array -->
> Send this file: <input name="userfile" type="file" />
> <br /><br />
> <input type="submit" value="Send File" />
> </form>
>
> ---------------------------------------------
> $uploaddir =
> '/home/httpd/vhosts/foxedge.net/httpdocs/lvs/phpclass/uploads/';
> $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
>
> echo '<pre>';
> if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
> echo "File is valid, and was successfully uploaded.\n";
> } else {
> echo "Possible file upload attack!\n";
> switch ($_FILES['userfile'] ['error'])
> { case 1:
> print '<p> The file is bigger than this PHP installation allows</p>';
> break;
> case 2:
> print '<p> The file is bigger than this form allows</p>';
> break;
> case 3:
> print '<p> Only part of the file was uploaded</p>';
> break;
> case 4:
> print '<p> No file was uploaded</p>';
> break;
>
> }
> }
>
> echo 'Here is some more debugging info:';
> print_r($_FILES);
>
> echo "</pre>";
>
>
>
>

attached mail follows:


You are talking about a few issues.

1. turn on / uncomment the extensions in the php.ini (use phpinfo.php
to figure out which php.ini you are using)

2. 404 means the requested doc or url is wrong or doesnt exist. this
isnt your webserver or php's fault. fix the url.

3. make sure you tell IIS to use the php.exe for all .php scripts

John

>
> ---------- Forwarded message ----------
> From: "Alon Solell" <alonwsco.com>
> To: <php-windowslists.php.net>
> Date: Fri, 19 Aug 2005 21:43:27 +0300
> Subject: Question about Windows Installation
> Hi Y'all,
>
> I think I'll stick to the 4.4.0 for now,. but the install process seemed pretty much the same for 5.0.4
>
> If I use the php installer,. it install only the barebone version of PHP.
> I need to add the extensions to support mbstring, mysql etc..
>
> I'm using IIS6 as this is a Windows 2003 Server and I have the requierment to use
> that. Otherwise, I'd use Apache. So.. I know lots of you will try to sway me to use Apache and Linux,. but that would be barking at the wrong tree. I have serveral Linux boxes working fine,. and I love them. This is a requirement from my end user so the need is to install the PHP with IIS6.
>
> What I've done so far:
>
> I created the following tree:
>
> C:\hostingapps\php\
>
> In that directory, I've unzipped the PHP package.
> From the instructions, I understood I need to move all the files in the direcotries:
>
> C:\hostingapps\php\dll
> C:\hostingapps\php\isap
>
> to the:
>
> C:\hostingapps\php\
>
>
> When I used the installer,.. it created a php.ini file in the
>
> C:\Windows\php.ini
>
> (using the installer worked fine, but no extensions were available).
>
> and I guess I can just use it?
>
> I also manually added the path:
>
> C:\hostingapps\php
>
> And then restarted the IIS server.
> However,. I'm still getting an error:
>
> HTTP Error 404 - File or directory not found.
> Internet Information Services (IIS)
>
> What am I missing?
>
> Thanks,
>
> -Alon.
>
>

attached mail follows:


after you make changes restart iis. btw apache works fine in this
scenario too. if the extensions still dont work then look for the
dll's make sure they are even installed for php/webserver to use

On 8/19/05, JM <frawst1gmail.com> wrote:
> You are talking about a few issues.
>
> 1. turn on / uncomment the extensions in the php.ini (use phpinfo.php
> to figure out which php.ini you are using)
>
> 2. 404 means the requested doc or url is wrong or doesnt exist. this
> isnt your webserver or php's fault. fix the url.
>
> 3. make sure you tell IIS to use the php.exe for all .php scripts
>
> John
>
>
> >
> > ---------- Forwarded message ----------
> > From: "Alon Solell" <alonwsco.com>
> > To: <php-windowslists.php.net>
> > Date: Fri, 19 Aug 2005 21:43:27 +0300
> > Subject: Question about Windows Installation
> > Hi Y'all,
> >
> > I think I'll stick to the 4.4.0 for now,. but the install process seemed pretty much the same for 5.0.4
> >
> > If I use the php installer,. it install only the barebone version of PHP.
> > I need to add the extensions to support mbstring, mysql etc..
> >
> > I'm using IIS6 as this is a Windows 2003 Server and I have the requierment to use
> > that. Otherwise, I'd use Apache. So.. I know lots of you will try to sway me to use Apache and Linux,. but that would be barking at the wrong tree. I have serveral Linux boxes working fine,. and I love them. This is a requirement from my end user so the need is to install the PHP with IIS6.
> >
> > What I've done so far:
> >
> > I created the following tree:
> >
> > C:\hostingapps\php\
> >
> > In that directory, I've unzipped the PHP package.
> > From the instructions, I understood I need to move all the files in the direcotries:
> >
> > C:\hostingapps\php\dll
> > C:\hostingapps\php\isap
> >
> > to the:
> >
> > C:\hostingapps\php\
> >
> >
> > When I used the installer,.. it created a php.ini file in the
> >
> > C:\Windows\php.ini
> >
> > (using the installer worked fine, but no extensions were available).
> >
> > and I guess I can just use it?
> >
> > I also manually added the path:
> >
> > C:\hostingapps\php
> >
> > And then restarted the IIS server.
> > However,. I'm still getting an error:
> >
> > HTTP Error 404 - File or directory not found.
> > Internet Information Services (IIS)
> >
> > What am I missing?
> >
> > Thanks,
> >
> > -Alon.
> >
> >
>

--
John Martinez
http://www.funkyfreshdesigns.com