Dan Goodes | 1 Jul 2005 01:02

Re: Achieving 64-bit integers on 32-bit platforms

On Thu, 30 Jun 2005 at 00:16, Richard Lynch wrote:

> On Wed, June 29, 2005 9:02 pm, Dan Goodes said:
> > This 32-bit limitation is haunting me everywhere I turn.
> >
> > Is it possible with PHP (at compile-time if need be) to make it use large
> > (64-bit) integers?
>
> I believe that PHP runs fine on 64-bit hardware, and uses 64-bit ints
> everywhere on that...
>
> So, in theory at least, just buying a 64-bit machine would "solve" your
> problem...
>
> Not that you necessarily *can* run out and buy a 64-bit machine, mind you.

yes. especially since each of our front-end webservers would need to be
64-bit to do what i was hoping to do. what I was hoping for was a way to
make php use 64-bit integers (or fake it somehow), such as apache2.0.54
does for files of that size.

> > I'm asking because I would like to perform operations on large files, and
> >
> > fillesize($filename)
> >
> > is returning an error, even when I use
> >
> > sprintf("%u", filesize($file))
> >
> > as per the manual for filesize(). I get:
(Continue reading)

Richard Lynch | 1 Jul 2005 01:11

Re: a basic array question!

On Sat, June 25, 2005 2:01 pm, bruce said:
> feel kind of foolish posting this.. but i can't seem to figure it out for
> now..

Here's a way to tackle this kind of thing in the future:

Divide and Conquer.

print_r($foo) prints out a BUNCH of stuff.

Focus only on the outer layer:

> i have an array, i can do a print_r($foo) and get the following:
> Array
> (
>     [bookmark] => 1
>     [facets] => Array
.
.
.

Then simply do:

print_r($foo['facets']);

Now you can ignore a bunch of crap you don't care about.

Focus on the outer layer and begin again:

Array
(Continue reading)

Richard Lynch | 1 Jul 2005 01:23

Re: Re: send email at certain hour

On Sat, June 25, 2005 11:55 am, Arthur Wiebe said:
> vlad georgescu wrote:
>> i want to make a "reminder" application which sends emails at certain
>> hour
>> in php. is this posibile ? if not, what else can I use ?
>>
>
> I've done it using pure PHP for a calendar script.
>
> What I did was write a PHP script with a loop that checks every second
> whether or not something should be done. For example:
>
>
> <?php
> $t = true;
> while ($t) {
>    if (time() == $myTimeStamp) {
>      mail(args);
>    }
> }
> ?>
>
> at the top of the script I have a line like this:
> #!/usr/bin/env php
> for *nixs' and I wrote a little batch file for Windows systems.
> At least it works.

This works, but it's kind of resource intensive, I think...

You've pretty much got a whole PHP binary running all day, every day.  Not
(Continue reading)

Richard Lynch | 1 Jul 2005 01:27

Re: Strange is_dir() behavior

On Sat, June 25, 2005 8:54 am, Marcos Mendonça said:
> Yes, if i try to to echo the variable $entry outside the if is returns
> the expected directories list.
>
> I tried giving it the full path and it still doesn't work.

Show us that source code.

Cuz I wouldn't expect it to work without the full path for is_dir()

But if it's not working with the full path...

You've done something wrong.

Okay, maybe you've found a bug in PHP that 1,238,874,988 other users have
missed...

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

Tim Burgan | 1 Jul 2005 01:11

Writing a PHP Web application

Hello,

What are the options to get code to run on the server (every XX
minutes), without any user interaction, etc.
Example 1: If I have a directory that contains files, can I write a
script that will delete all files older that 5 days?
Example 2: If I write an email web application, and the user wants to
send an email to 50 people, can I write a script that will send emails
individually XX seconds apart from each other, but have the progress
interfaced with the web page the user is on so they can see the
percentage progress of sent emails.

Is this possible? How do I do such things?
Are there any resources available that can help me with this?

Also,  back to the email example, is it possible that once an email is
composed and sent, that the web application can scan the email for
viruses, then show a message to the user if a virus was found in their
email, if no virus found, the email is then sent to the users as above.

How would I scan an email for viruses (or spam?)? And, scan it only once
so that system resources are not used to scan unnecessarily for every
recipient?

Any help would be greatly appreciated.

Thanks

Tim

(Continue reading)

Richard Lynch | 1 Jul 2005 01:41

Re: Verifying images with getimagesize()

On Sat, June 25, 2005 8:41 am, Jack Jackson said:
> Thanks for telling me about that, Edward. I apprecate it. Actually in
> this case I was using it only to verify that it was something like an
> image to validate the file type before allowing it on the server. But
> you raise a very good point and I appreciate it.

Just to be sure we aren't providing a false sense of security through
silence...

It *IS* possible (remotely, theoretically) somebody could construct an
image that passes getimagesize() and is a really nasty binary trojan
software hack to destroy your site.

It's even possible (very remotely, very theoretically) that it would look
like a perfectly fine image in Photoshop or any other application.

getimagesize() does not magically make you 100% "safe" -- It just means
that at least they took SOME effort to disguise the malware, and will have
to make a great deal of effort to make that malware execute and actually
*do* something, much less do something destructive.

Feel free to try chmod-ing your JPGs to be executable and then do
/full/path/to/images/silly.jpg from the command line...

Errr. Maybe you'd better do this on a computer you don't care about JUST
IN CASE.  You'd have to stumble across the 1 in a zillion chance this
would actually do anything, but it's there...

I think the first few bytes alone of a valid image are, by definition, not
a valid binary executable file, but don't quote me on that.
(Continue reading)

Richard Lynch | 1 Jul 2005 01:50

Re: Stop spreading PEAR FUD; WAS Re: [PHP] Re: PHP web archeticture

On Sat, June 25, 2005 7:32 am, Matthew Weier O'Phinney said:
> * Catalin Trifu <catalin <at> isp-software.de> :
>> I also tend to stay away from PEAR, which is kinda bloated for my
>> taste, except the Log package.
>
> <rant>
> I hear that a lot on this list, and I don't understand the reasoning
> behind such comments -- perhaps because nobody offers any reasoning,
> only the opinion?
>
> I'm a PEAR user, and I've found the packages anything *but* bloated.
> Granted, I only use a subset of PEAR, but that subset has made mycoding
> easier. I use DB, Log, Mail, Mail_MIME, HTML_QuickForm, Cache_Lite, and
> Pager daily; additionally, we use custom PEAR error handlers to catch
> errors generated by these packages, log them, and display custom error
> pages. If I'd had to write the functionality I have readily available in
> these packages, I wouldn't have a job right now. They've helped me meet
> numerous deadlines.
>
> If somebody could offer some *constructive* criticism of PEAR -- PEAR as
> it is TODAY, not "3 years ago, when I last tried it" -- these comments
> would have more weight. As it is, I feel they're just FUD based on
> ignorance.
> </rant>

<rant>
When I see some killer feature in PEAR that I think will make up for the
*DAYS* of my time that PEAR wasted three years ago, I'll try it again.

I remain adamant that PEAR is bloated, has too many internal dependencies,
(Continue reading)

Philip Hallstrom | 1 Jul 2005 01:54

Re: Writing a PHP Web application

> What are the options to get code to run on the server (every XX
> minutes), without any user interaction, etc.

If you are running on a unix like system (linux, freebsd, solaris, etc.) 
cron can do this for you.  See this: http://en.wikipedia.org/wiki/Cron

If on windows there are probably scheduling applications, but I don't know 
anything about them.

> Example 1: If I have a directory that contains files, can I write a
> script that will delete all files older that 5 days?

Yes.  Write the script to do what you want it to do and then have cron 
execute it on the time period you define.

> Example 2: If I write an email web application, and the user wants to
> send an email to 50 people, can I write a script that will send emails
> individually XX seconds apart from each other, but have the progress
> interfaced with the web page the user is on so they can see the
> percentage progress of sent emails.

Yes.  This is a bit trickier as you would need to coordinate with a 
backend process that looks for emails that are ready to send them, does 
the sending and also writes out some status info (either to a temp file or 
to a database, or to shared memory).  Then your web page would need to 
repeatedly check that status to update the user on the progress.

> Also,  back to the email example, is it possible that once an email is
> composed and sent, that the web application can scan the email for
> viruses, then show a message to the user if a virus was found in their
(Continue reading)

Graham Anderson | 1 Jul 2005 01:54

getting a filename [with no extension] out of a url

if  $_SERVER['SCRIPT_NAME'] give this....
/folder/folder/Library/php/filename.php

what would be the proper way to strip the string until only 'filename' 
is left
I'm a bit new at eregi stuff

any help would be appreciated
many thanks

g

--

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

Tom Rogers | 1 Jul 2005 02:09

Re: getting a filename [with no extension] out of a url

Hi,

Friday, July 1, 2005, 9:54:42 AM, you wrote:
GA> if  $_SERVER['SCRIPT_NAME'] give this....
GA> /folder/folder/Library/php/filename.php

GA> what would be the proper way to strip the string until only 'filename'
GA> is left
GA> I'm a bit new at eregi stuff

GA> any help would be appreciated
GA> many thanks

GA> g

I do this:
$file = '/folder/folder/Library/php/filename.php';
$ext =  <at> substr($file, ( <at> strrpos($file, ".") ?  <at> strrpos($file, ".") + 1 :  <at> strlen($file)),  <at> strlen($file));
$fname = basename($file,$ext);

-- 
regards,
Tom

--

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


Gmane