[PHP] is it worth using apache2 with php 4.3.4

2005-08-19 Thread bala chandar
Hi,

i am now using apache 1.3.x with php 4.3.4

is it worth upgrading to apache 2.x
-- 
bala> balachandar muruganantham
Y!   > mbchandar
Hotmail >  mbchandar
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

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



[PHP] setting 'sendmail_from' on windows

2005-08-19 Thread George Pitcher
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

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



Re: [PHP] Catching all errors and redirecting

2005-08-19 Thread Mark Rees
""Jay Blanchard"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[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.

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



[PHP] Re: setting 'sendmail_from' on windows

2005-08-19 Thread Mark Rees
""George Pitcher"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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



[PHP] Re: Catching all errors and redirecting

2005-08-19 Thread Norbert Wenzel

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}


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



RE: [PHP] Re: setting 'sendmail_from' on windows

2005-08-19 Thread George Pitcher
Mark,

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

Cheers

George

> -Original Message-
> From: Mark Rees [mailto:[EMAIL PROTECTED]
> Sent: 19 August 2005 9:42 am
> To: php-general@lists.php.net
> Subject: [PHP] Re: setting 'sendmail_from' on windows
> 
> 
> ""George Pitcher"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > 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
> 
> 

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



Re: [PHP] php 5.04 register_globals aint acting right.

2005-08-19 Thread Jochem Maas

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:



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);
}
}






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



Re: [PHP] 'God' has spoken... :-)

2005-08-19 Thread Jochem Maas

Richard Lynch wrote:

On Wed, August 17, 2005 2:05 am, Dotan Cohen wrote:


On 8/15/05, Miles Thompson <[EMAIL PROTECTED]> 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 :-)





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



[PHP] Problem mit PEAR-Package Log

2005-08-19 Thread Sabine

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:


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);


--> 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.


$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();


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



Thank you very much in advance
Sabine

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



Re: [PHP] Differences with imap_headerinfo() between PHP 4.3.11 and 4.4.0?

2005-08-19 Thread Mike Walsh

""Richard Lynch"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> 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

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



RE: [PHP] clearing cache contents

2005-08-19 Thread Jay Blanchard
[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.

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



RE: [PHP] Re: setting 'sendmail_from' on windows

2005-08-19 Thread George Pitcher
Mark,

Just to let you know that it did the trick.

Cheers

George

> -Original Message-
> From: Mark Rees [mailto:[EMAIL PROTECTED]
> Sent: 19 August 2005 9:42 am
> To: php-general@lists.php.net
> Subject: [PHP] Re: setting 'sendmail_from' on windows
> 
> 
> ""George Pitcher"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > 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
> 
> 

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



RE: [PHP] Catching all errors and redirecting O T

2005-08-19 Thread Jay Blanchard
[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.

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



[PHP] Unique user?

2005-08-19 Thread Gustav Wiberg

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

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



RE: [PHP] Re: previous + next buttons, no DB

2005-08-19 Thread Jim Moseby
> 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  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

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



[PHP] [really O T] Re: [PHP] Catching all errors and redirecting O T

2005-08-19 Thread Jochem Maas

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? ;-)





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



RE: [PHP] Unique user?

2005-08-19 Thread Jay Blanchard
[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.

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



[PHP] upload large files troubles

2005-08-19 Thread curipin

 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 = 7
max_input_time = 7
memory_limit = 16M
post_max_size = 900M
upload_max_filesize = 900M
default_socket_timeout = 8
I think, these are all interested parts in this problem.
Thanks.

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



RE: [PHP] upload large files troubles

2005-08-19 Thread Jay Blanchard
[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 = 7
max_input_time = 7
memory_limit = 16M
post_max_size = 900M
upload_max_filesize = 900M
default_socket_timeout = 8
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?






Send this file: 



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



RE: [PHP] upload large files troubles

2005-08-19 Thread Jay Blanchard
[snip]  
Sure, it looks:





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.

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



Re: [PHP] Catching all errors and redirecting O T

2005-08-19 Thread John Nichel

Jay Blanchard wrote:


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
[EMAIL PROTECTED]

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



[PHP] Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] Install PHP in Linux

2005-08-19 Thread John Nichel

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
[EMAIL PROTECTED]

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



Re: [PHP] preg_match

2005-08-19 Thread John Nichel

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



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
[EMAIL PROTECTED]

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



Re: [PHP] preg_match

2005-08-19 Thread John Nichel

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
[EMAIL PROTECTED]

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



RE: [PHP] upload large files troubles

2005-08-19 Thread Jay Blanchard
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.

Back to upload";
}
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

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



Re: [PHP] Unique user?

2005-08-19 Thread Jason Barnett
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.

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



[PHP] Re: is it worth using apache2 with php 4.3.4

2005-08-19 Thread Matthew Weier O'Phinney
* bala chandar <[EMAIL PROTECTED]>:
> 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/

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



Re: [PHP] Re: PHP MySQL insert

2005-08-19 Thread Ben Ramsey
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 <[EMAIL PROTECTED]> 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.


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



Re: [PHP] is it worth using apache2 with php 4.3.4

2005-08-19 Thread John Nichel

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
[EMAIL PROTECTED]

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



Re: [PHP] preg_match

2005-08-19 Thread Matthew Weier O'Phinney
* John Nichel <[EMAIL PROTECTED]> :
> 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
> 
>
> 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/

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



Re: [PHP] ob_start changed from php4 to php5?

2005-08-19 Thread Marten Lehmann

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

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



[PHP] Re: How to show complete exception text?

2005-08-19 Thread Christopher J. Bottaro
Kevin Waterson wrote:

> This one time, at band camp, "Christopher J. Bottaro"
> <[EMAIL PROTECTED]> 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..
>  
> 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

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



[PHP] Call to Static Method PHP5

2005-08-19 Thread Adrian Cid Almaguer
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:

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


Re: [PHP] Re: previous + next buttons, no DB

2005-08-19 Thread Ashley M. Kirchner

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    .   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. 


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



Re: [PHP] Week Days

2005-08-19 Thread Jordan Miller

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".






On Aug 19, 2005, at 12:57 AM, [EMAIL PROTECTED] 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.





[PHP] Re: Call to Static Method PHP5

2005-08-19 Thread M. Sokolewicz

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:



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:


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



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



[PHP] Error checking on file upload

2005-08-19 Thread Peppy
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







Send this file: 




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

echo '';
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 ' The file is bigger than this PHP installation 
allows';
   break;
case 2:
   print ' The file is bigger than this form allows';
   break;
case 3:
   print ' Only part of the file was uploaded';
   break;
case 4:
   print ' No file was uploaded';
   break;
   
 }
}

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

echo "";




Re: [PHP] Week Days

2005-08-19 Thread Robert Cummings
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".
> 
>  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, [EMAIL PROTECTED] 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.  |
`'

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



Re: [PHP] Error checking on file upload

2005-08-19 Thread Steve Slotnick
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 < [EMAIL PROTECTED]> 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
> 
> 
> 
>  
> 
> 
> 
> Send this file:  
> 
> 
> 
> 
> -
> $uploaddir = 
> '/home/httpd/vhosts/foxedge.net/httpdocs/lvs/phpclass/uploads/'; 
> $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
> 
> echo '';
> 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 ' The file is bigger than this PHP installation allows';
> break;
> case 2:
> print ' The file is bigger than this form allows';
> break;
> case 3:
> print ' Only part of the file was uploaded';
> break;
> case 4:
> print ' No file was uploaded';
> break;
> 
> }
> }
> 
> echo 'Here is some more debugging info:';
> print_r($_FILES);
> 
> echo "";
> 
> 
> 
>


Re: [PHP] Error checking on file upload

2005-08-19 Thread Steve Slotnick
Sorry, I meant case 1.

- Steve

On 8/19/05, Steve Slotnick <[EMAIL PROTECTED]> 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 < [EMAIL PROTECTED]> 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
> > 
> > 
> > 
> >  
> > 
> > 
> > 
> > Send this file:  
> > 
> > 
> > 
> > 
> > -
> > $uploaddir = 
> > '/home/httpd/vhosts/foxedge.net/httpdocs/lvs/phpclass/uploads/'; 
> > $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
> > 
> > echo '';
> > 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 ' The file is bigger than this PHP installation allows';
> > break;
> > case 2:
> > print ' The file is bigger than this form allows';
> > break;
> > case 3:
> > print ' Only part of the file was uploaded';
> > break;
> > case 4:
> > print ' No file was uploaded';
> > break;
> > 
> > }
> > }
> > 
> > echo 'Here is some more debugging info:';
> > print_r($_FILES);
> > 
> > echo "";
> > 
> > 
> > 
> > 
>


Re: [PHP] Error checking on file upload

2005-08-19 Thread Peppy
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 < [EMAIL PROTECTED]> 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
>
>
> 
> 
> 
>
> 
> Send this file: 
> 
> 
> 
>
> -
> $uploaddir =
> '/home/httpd/vhosts/foxedge.net/httpdocs/lvs/phpclass/uploads/';
> $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
>
> echo '';
> 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 ' The file is bigger than this PHP installation allows';
> break;
> case 2:
> print ' The file is bigger than this form allows';
> break;
> case 3:
> print ' Only part of the file was uploaded';
> break;
> case 4:
> print ' No file was uploaded';
> break;
>
> }
> }
>
> echo 'Here is some more debugging info:';
> print_r($_FILES);
>
> echo "";
>
>
>
>

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



Re: [PHP] Week Days

2005-08-19 Thread Philip Hallstrom

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".




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

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



Re: [PHP] Week Days

2005-08-19 Thread Robert Cummings
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".
> >>
> >>  >> 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.  |
`'

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



Re: [PHP] Week Days

2005-08-19 Thread Robert Cummings
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".
> >>
> >>  >> 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.  |
`'

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



Re: [PHP] Week Days

2005-08-19 Thread Philip Hallstrom

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.

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



[PHP] Re: Unique user?

2005-08-19 Thread A.W. Wright

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

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



[PHP] Re: is it worth using apache2 with php 4.3.4

2005-08-19 Thread Awright

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.

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



[PHP] Re: php-windows Digest 19 Aug 2005 19:00:33 -0000 Issue 2754

2005-08-19 Thread JM
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" <[EMAIL PROTECTED]>
> To: 
> 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.
> 
>

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



[PHP] Question about Windows Installation

2005-08-19 Thread JM
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 <[EMAIL PROTECTED]> 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" <[EMAIL PROTECTED]>
> > To: 
> > 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

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



Re: [PHP] Re: PHP MySQL insert

2005-08-19 Thread areguera
sorry...here is the message

On 8/19/05, areguera <[EMAIL PROTECTED]> wrote:
> On 8/19/05, Ben Ramsey <[EMAIL PROTECTED]> 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
> >
> >
>

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



Re: [PHP] 'God' has spoken... :-)

2005-08-19 Thread Dotan Cohen
On 8/19/05, Jochem Maas <[EMAIL PROTECTED]> 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

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



[PHP] Re: Unique user?

2005-08-19 Thread Labunski
Simply ad some info to the Cookies (including date and time). 

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



[PHP] Document source code for PHP5

2005-08-19 Thread Markus Fischer

Hi,

I'm currently using phpdoc.org to generated documentation of my code, 
but it doesn't seem to support PHP5. Interfaces are not recognized and 
function headers defined therein are parsed as public function.


Can someone recommend a documentation tool which supports the new PHP5 
syntax?


thanks,
- markus

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



[PHP] Automated data upload for customers

2005-08-19 Thread Brian Dunning
I have a system where I'm trying to facilitate a process for  
customers to upload data to me (basically a list of people), and have  
it go into a database. I can give them certain parameters, like it  
has to be a CSV file, delimited in such a way, etc. but can't ask  
much more of them than that, since people are largely stupid.  :)


And then there would be the usual multipart form upload where they  
select their file and send it up. I'd need to import it into MySQL.


Before I sit down and start coding this thing from scratch, does  
anyone know if there is something similar out there already that  
could give me a head start?


- Brian

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



Re: [PHP] Automated data upload for customers

2005-08-19 Thread Jasper Bryant-Greene

Brian Dunning wrote:
I have a system where I'm trying to facilitate a process for  customers 
to upload data to me (basically a list of people), and have  it go into 
a database. I can give them certain parameters, like it  has to be a CSV 
file, delimited in such a way, etc. but can't ask  much more of them 
than that, since people are largely stupid.  :)


For CSV, it's as simple as explode() the data by "\n" (perhaps strip out 
any "\r" before you start) and then explode() by ",". Depending on the 
software they're using, you might also need to remove any delimiters on 
each field of data, such as quote marks (").


If other file formats are possible as well as CSV, you might like to 
look at the PEAR "File Formats" packages[1].


And then there would be the usual multipart form upload where they  
select their file and send it up. I'd need to import it into MySQL.


Again, just receive the file data, do some checking to make sure it's of 
the expected type, run mysql_real_escape_string() on it, and insert it 
into a MySQL table.


You could use a PEAR package such as HTTP_Upload[2] to help with the 
uploading bit, and perhaps a database abstraction layer such as PEAR's 
DB package[3] for the MySQL bit.


Before I sit down and start coding this thing from scratch, does  anyone 
know if there is something similar out there already that  could give me 
a head start?


HTH

Jasper

[1] http://pear.php.net/packages.php?catpid=33&catname=File%20Formats
[2] http://pear.php.net/package/HTTP_Upload
[3] http://pear.php.net/package/DB

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



Re: [PHP] Automated data upload for customers

2005-08-19 Thread Richard Lynch
On Fri, August 19, 2005 3:47 pm, Jasper Bryant-Greene wrote:
> Brian Dunning wrote:
>> I have a system where I'm trying to facilitate a process for
>> customers
>> to upload data to me (basically a list of people), and have  it go
>> into
>> a database. I can give them certain parameters, like it  has to be a
>> CSV
>> file, delimited in such a way, etc. but can't ask  much more of them
>> than that, since people are largely stupid.  :)
>
> For CSV, it's as simple as explode() the data by "\n" (perhaps strip
> out
> any "\r" before you start) and then explode() by ",". Depending on the
> software they're using, you might also need to remove any delimiters
> on
> each field of data, such as quote marks (").

No, it's not that simple, as embedded commas can be inside of quotes,
and then quote quote is used for quotes inside of quotes.

Which is why PHP has a function for reading CSV files.
http://php.net/fgetcsv I believe.

> If other file formats are possible as well as CSV, you might like to
> look at the PEAR "File Formats" packages[1].

Now TAB delimited is generally easier than CSV as it IS as simple as
reading a line and explode() on "\t"

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Automated data upload for customers

2005-08-19 Thread Jasper Bryant-Greene

Richard Lynch wrote:

On Fri, August 19, 2005 3:47 pm, Jasper Bryant-Greene wrote:

For CSV, it's as simple as explode() the data by "\n" (perhaps strip
out
any "\r" before you start) and then explode() by ",". Depending on the
software they're using, you might also need to remove any delimiters
on
each field of data, such as quote marks (").


No, it's not that simple, as embedded commas can be inside of quotes,
and then quote quote is used for quotes inside of quotes.

Which is why PHP has a function for reading CSV files.
http://php.net/fgetcsv I believe.


Very good point. It can still be solved relatively simply with PHP's 
string and/or regex functions though, although that would be rather 
pointless as a function already exists. Thanks for pointing out the 
function, I hadn't seen it before.



If other file formats are possible as well as CSV, you might like to
look at the PEAR "File Formats" packages[1].


Now TAB delimited is generally easier than CSV as it IS as simple as
reading a line and explode() on "\t"


Unless of course the field is delimited with quotes and contains an 
embedded tab character? Just a guess, I haven't had any reason to use 
tab-delimited files before.


Jasper

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



Re: [PHP] Re: PHP MySQL insert

2005-08-19 Thread Richard Lynch
On Fri, August 19, 2005 12:56 pm, areguera wrote:
>> could you suggest something about Latin characters and portability?.

As I understand it, or not, more likely, you want to configure your
MySQL server to use UTF-8, and your MySQL client to use UTF-8 and
pretty much everything to use UTF-8, and then you can convert your
data to UTF-8 and its gonna store it in a way that you'll be able to
convert back to Latin-1 or whatever you like.

At least, that's what Mark Matthews of MySQL A/B said in his talk
about this at our more recent Chicago MySQL User Group meeting.

You may want to take this question to the i18n PHP list, where people
who have actually done it hang out. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] preg_match

2005-08-19 Thread Richard Lynch
On Fri, August 19, 2005 7:03 am, Matthew Weier O'Phinney wrote:
> * John Nichel <[EMAIL PROTECTED]> :
>> 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
>> 
>>
>> 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*

But Perl isn't going to *SEE* \\s !!!

PHP is going to *EAT* \\ and make \ out of it.

That's why \ is an escape character in PHP.

It's also an escape character in Perl/PCRE.

Some days I think PHP's escape character should have been | or
something, just so this topic wouldn't come up every damn month.

>> 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);

But in single quote \ is ALSO an escape, albeit for a smaller number
of characters -- 2, to be precise.

I don't care if you use single or double quotes, if you want PCRE to
get \s, then PHP should be using \\s inside of them.

PHP "eats" a \\ and spits out \ and then PCRE "sees" \s which is what
you want.

This is true for both single and double quotes.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] preg_match

2005-08-19 Thread Richard Lynch
On Fri, August 19, 2005 6:35 am, John Nichel wrote:
> 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.

Not a chance.

PHP is gonna splice $total into the string ages and ages before PCRE
sees it.

Okay, microseconds before, really, but that's ages in electron time. :-)

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

I still contend that $total has "/#" in it when it breaks.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] preg_match

2005-08-19 Thread Richard Lynch
On Fri, August 19, 2005 6:32 am, John Nichel wrote:
> 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
> 
>
> 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.

Actually, if he really needs a minimum of three spaces, as this string
indicates...

"\\s{3,}"

is probably the clearest representation.

Or possibly " {3,}"

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] upload large files troubles

2005-08-19 Thread Richard Lynch
On Fri, August 19, 2005 5:47 am, curipin wrote:

> 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 = 7
> max_input_time = 7
> memory_limit = 16M
> post_max_size = 900M
> upload_max_filesize = 900M
> default_socket_timeout = 8
> I think, these are all interested parts in this problem.

I believe httpd.conf has a RequestBodyLimit or somesuch which is also
a factor.

It's also possible that the *BROWSER* is going to time-out for an
action that takes too long, whether it's still pushing data or not.

I have a HUGE distrust of web browsers, so will go out on a limb and say:

Web browsers are not reliable transport mechanisms for upload of
monster files. Use FTP.

That might be wrong, but that's my story, and I'm sticking to it.

If somebody else wants to claim that uploading 200MB files in a
browser is a Good Idea, go right ahead.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] php explained in sql

2005-08-19 Thread John Taylor-Johnston
In php, if I wanted to know if $mydata->email contained something, I 
would do this, right?

if ($mydata->email)
{}

How would I express this in SQL (MySQL)?

Thanks. Sorry to be off-topic, if I am,
John

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



Re: [PHP] upload large files troubles

2005-08-19 Thread Jasper Bryant-Greene

Richard Lynch wrote:

I have a HUGE distrust of web browsers, so will go out on a limb and say:

Web browsers are not reliable transport mechanisms for upload of
monster files. Use FTP.

That might be wrong, but that's my story, and I'm sticking to it.

If somebody else wants to claim that uploading 200MB files in a
browser is a Good Idea, go right ahead.


I've definitely got to agree with you here. If you need to upload 
anything that size, or even half that size, I'd either use FTP, or 
develop something using raw sockets and a custom client app (if it 
needed to be super-user-friendly and your users didn't necessarily know 
how to use FTP).


Jasper

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



Re: [PHP] php 5.04 register_globals aint acting right.

2005-08-19 Thread Richard Lynch
On Fri, August 19, 2005 2:14 am, Jochem Maas wrote:
> 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);
>  }
> }
>

Like, if you are doing this before anything else in your script, I
*THINK* you could just do:

$GLOBALS = array();

instead of all that looping and stuff.

I don't THINK there are any variables you're not nuking anyway...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] php explained in sql

2005-08-19 Thread Jasper Bryant-Greene

John Taylor-Johnston wrote:
In php, if I wanted to know if $mydata->email contained something, I 
would do this, right?

if ($mydata->email)
{}

How would I express this in SQL (MySQL)?


That doesn't tell you if $mydata->email contains something. It tells you 
whether the value of $mydata->email, when cast to boolean, equals TRUE. 
If $mydata->email equaled zero or the string "0", it would still contain 
something, but that if statement would not get executed.


In MySQL, it would depend on the datatype. You could do any of the 
following, depending on what you actually want to do:


colname<>''
colname<>0
colname IS NOT NULL

Or, if you're in MySQL >= 5.0.2 and are using true boolean values:

colname IS TRUE

or, if you just want to check if it's TRUE or UNKNOWN:

colname IS NOT FALSE


Jasper

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



Re: [PHP] Week Days

2005-08-19 Thread Richard Lynch
On Thu, August 18, 2005 10:57 pm, [EMAIL PROTECTED] 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.

Assuming you are willing to ignore holidays, which in most real-world
applications, you're not...



-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Automated data upload for customers

2005-08-19 Thread Richard Lynch
On Fri, August 19, 2005 7:45 pm, Jasper Bryant-Greene wrote:
>>>If other file formats are possible as well as CSV, you might like to
>>>look at the PEAR "File Formats" packages[1].
>>
>> Now TAB delimited is generally easier than CSV as it IS as simple as
>> reading a line and explode() on "\t"
>
> Unless of course the field is delimited with quotes and contains an
> embedded tab character? Just a guess, I haven't had any reason to use
> tab-delimited files before.

tab-delimited does not allow tabs in data, nor newlines.

There is no escape character.

It follows the KISS principle.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Hardware Detection

2005-08-19 Thread Saenal M

Hi,

Can we get information about hardware on client's PC. (e.g. hard disk, 
processor, keyboard, etc).? And How?

anyone knows? please reply back.

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



Re: [PHP] Week Days

2005-08-19 Thread Robert Cummings
On Sat, 2005-08-20 at 00:00, Richard Lynch wrote:
> On Thu, August 18, 2005 10:57 pm, [EMAIL PROTECTED] 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.
> 
> Assuming you are willing to ignore holidays, which in most real-world
> applications, you're not...
> 
>$certain_date = '8/19/2005';
>   $week_days = '...';
>   list($m, $d, $y) = explode('/', $certain_date);
>   $start = mktime(0, 0, 0, $m, $d, $y);
>   //Every 5 days is a full week:
>   $weeks = floor($week_days/5);
>   $close = mktime(0, 0, 0, $m, $d + $weeks * 7, $y);
>   $remainder = $week_days % 5;
>   for ($added = 0, $day = 0; $added < $remainder; $day++){
> $dow = date('w', $close + $day*60*60*24); //Is it 'w' for 'day of
> week'?
> if ($dow == 0 || $dow == 1){ //0|1 are Sun/Sat, right?

No, 6 is saturday :B   You know, I was looking for which fricking macro
expanded to a non locale based indicator for the day of the week
yesterday (ala the 'w' for date()). I guess my eyes were getting fuzzy
*grin*.

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

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