php-general Digest 7 May 2008 17:51:55 -0000 Issue 5446
Topics (messages 273967 through 273998):
Re: the Y2K38 BUG
273967 by: Stephen Johnson
273968 by: Paul Scott
273969 by: Jon L.
273970 by: Kalle Sommer Nielsen
273971 by: Nathan Nobbe
273973 by: Nathan Nobbe
273974 by: Paul Scott
273975 by: Chris Haensel
273989 by: Nathan Nobbe
273996 by: Daniel Brown
Re: Handling Incoming Email Attachments
273972 by: Manuel Lemos
Re: PHP Web Apps & OpenID
273976 by: Colin Guthrie
273995 by: Joe Harman
AI file and mapping with PHP
273977 by: Angelo Zanetti
273978 by: Aschwin Wesselius
273979 by: Angelo Zanetti
273980 by: Paul Scott
273986 by: Thijs Lensselink
Problems with mod_vhost_alias and PHP require
273981 by: Mário Gamito
273982 by: Aschwin Wesselius
Re: GD - JPEG to PNG with transparency and color
273983 by: tedd
Re: Where to start!
273984 by: tedd
php make fails with Sybase15
273985 by: Lorena
How to determine if file is writable and deletable
273987 by: Al
273988 by: Aschwin Wesselius
273990 by: Al
273993 by: robinv.gmail.com
273994 by: Thiago Pojda
$_SESSION v. Cookies
273991 by: Scott Campbell
273992 by: Robert Cummings
273997 by: Wolf
Re: Re[PHP] gex to catch <p>s
273998 by: Ryan S
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Seriously.... If your apps are still being used in 2038 ... WOW!
This is an issue that will more then likely be well resolved LONG before
2038...
On 5/6/08 10:50 PM, "Nathan Nobbe" <[EMAIL PROTECTED]> wrote:
> On Tue, May 6, 2008 at 10:57 PM, Paul Scott <[EMAIL PROTECTED]> wrote:
>
>>
>> On Wed, 2008-05-07 at 10:03 +0530, Chetan Rane wrote:
>>> Have guys heard of the the Y2K38 Bug more details are on this link
>>>
>>
>> Nope, but I can guess what its about.
>>
>>> Can there be a possible solution. As the system which I am developing
>>> for my client uses Unix timestamp.
>>>
>>
>> There are probably multiple solutions. AFAIK time is a 32 bit signed
>> int, making it unsigned would add like 100 years onto your app.
>>
>>> This might effect my application in the future
>>>
>>
>> If your app survives that long! Why not just maintain it and when times
>> change, your app changes? :)
>>
>> Seriously, this is really not a big deal!
>
>
> true-that ;)
> anyway, the DateTime class is implemented as a 64-bit unsigned (i think)
> value. so if you use it you should be good to go.
>
> php > echo date_create('2040-10-24')->format('M-d-Y');
> Oct-24-2040
>
> -nathan
--
Stephen Johnson
The Lone Coder
http://www.ouradoptionblog.com
*Join us on our adoption journey*
[EMAIL PROTECTED]
http://www.thelonecoder.com
*Continuing the struggle against bad code*
--
--- End Message ---
--- Begin Message ---
On Tue, 2008-05-06 at 23:50 -0600, Nathan Nobbe wrote:
> true-that ;)
> anyway, the DateTime class is implemented as a 64-bit unsigned (i think)
> value. so if you use it you should be good to go.
>
> php > echo date_create('2040-10-24')->format('M-d-Y');
> Oct-24-2040
>
a 64bit unsigned int is best, but that would only work properly on 64bit
arch. For 32bit users, making it unsigned is the best option for now,
and I suppose that by 2038 there will be another option.
As far as I am concerned, this discussion is a discussion for the sake
of discussion. If I am still using the same apps that I use today in
2038, I will officially rethink my usefulness as a human being :)
--Paul
All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
--- End Message ---
--- Begin Message ---
Another possibility...
Port the Date object implementation from ECMA/Javascript.
It has a range of +/-8.64e15, or Tue, 20 Apr -271821 00:00:00 GMT to Sat, 13
Sep 275760 00:00:00 GMT.
You know...just to have a little extra time to find something else. ;)
- Jon L.
On Wed, May 7, 2008 at 12:56 AM, Paul Scott <[EMAIL PROTECTED]> wrote:
>
> On Tue, 2008-05-06 at 23:50 -0600, Nathan Nobbe wrote:
> > true-that ;)
> > anyway, the DateTime class is implemented as a 64-bit unsigned (i think)
> > value. so if you use it you should be good to go.
> >
> > php > echo date_create('2040-10-24')->format('M-d-Y');
> > Oct-24-2040
> >
>
> a 64bit unsigned int is best, but that would only work properly on 64bit
> arch. For 32bit users, making it unsigned is the best option for now,
> and I suppose that by 2038 there will be another option.
>
> As far as I am concerned, this discussion is a discussion for the sake
> of discussion. If I am still using the same apps that I use today in
> 2038, I will officially rethink my usefulness as a human being :)
>
> --Paul
>
>
> All Email originating from UWC is covered by disclaimer
> http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Quoting "Jon L." <[EMAIL PROTECTED]>:
Another possibility...
Port the Date object implementation from ECMA/Javascript.
It has a range of +/-8.64e15, or Tue, 20 Apr -271821 00:00:00 GMT to Sat, 13
Sep 275760 00:00:00 GMT.
You know...just to have a little extra time to find something else. ;)
- Jon L.
That would be a quite interesting move, try propose it to Derick ;)
On Wed, May 7, 2008 at 12:56 AM, Paul Scott <[EMAIL PROTECTED]> wrote:
On Tue, 2008-05-06 at 23:50 -0600, Nathan Nobbe wrote:
> true-that ;)
> anyway, the DateTime class is implemented as a 64-bit unsigned (i think)
> value. so if you use it you should be good to go.
>
> php > echo date_create('2040-10-24')->format('M-d-Y');
> Oct-24-2040
>
a 64bit unsigned int is best, but that would only work properly on 64bit
arch. For 32bit users, making it unsigned is the best option for now,
and I suppose that by 2038 there will be another option.
As far as I am concerned, this discussion is a discussion for the sake
of discussion. If I am still using the same apps that I use today in
2038, I will officially rethink my usefulness as a human being :)
--Paul
All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Kalle Sommer Nielsen
Danmarks Radio - www.dr.dk
--- End Message ---
--- Begin Message ---
On Tue, May 6, 2008 at 11:56 PM, Paul Scott <[EMAIL PROTECTED]> wrote:
>
> On Tue, 2008-05-06 at 23:50 -0600, Nathan Nobbe wrote:
> > true-that ;)
> > anyway, the DateTime class is implemented as a 64-bit unsigned (i think)
> > value. so if you use it you should be good to go.
> >
> > php > echo date_create('2040-10-24')->format('M-d-Y');
> > Oct-24-2040
> >
>
> a 64bit unsigned int is best, but that would only work properly on 64bit
> arch. For 32bit users, making it unsigned is the best option for now,
> and I suppose that by 2038 there will be another option.
i put "i think" only because im not 100% on the implementation, though i
know it has something to do w/ 64-bits; and it does seem to support a
massive range of dates on a 32-bit system. and also, there is good reason
to use it, if for example you have dates that are prior to dec 13, 1901.
the standard date() stuff chokes on anything earlier than that. and even
now, i have dealt with applications doing date arithmetic that spilled over
2038, breaking existing logic.
php > echo `uname -p` . PHP_EOL;
AMD Athlon(tm) XP 1500+
php > echo date('M-d-Y', -5555500000);
Dec-13-1901
php > echo date_create('@-5555500000')->format('M-d-Y');
Dec-14-1793
> As far as I am concerned, this discussion is a discussion for the sake
> of discussion. If I am still using the same apps that I use today in
> 2038, I will officially rethink my usefulness as a human being :)
as far as im concerned ive committed to using DateTime ever since i learned
of its superior internal implementation. that way i dont have to deal with
silly bounds related limitations in my date time calcs, ever (practically
speaking) :D
except of course those introduced by umm, human error ;)
-nathan
--- End Message ---
--- Begin Message ---
On Wed, May 7, 2008 at 12:48 AM, Kalle Sommer Nielsen <[EMAIL PROTECTED]> wrote:
> Quoting "Jon L." <[EMAIL PROTECTED]>:
>
> Another possibility...
>> Port the Date object implementation from ECMA/Javascript.
>> It has a range of +/-8.64e15, or Tue, 20 Apr -271821 00:00:00 GMT to Sat,
>> 13
>> Sep 275760 00:00:00 GMT.
>>
>> You know...just to have a little extra time to find something else. ;)
>>
>> - Jon L.
>>
>
> That would be a quite interesting move, try propose it to Derick ;)
looks like mine only goes to dec. 31, 9999 =/
php > echo date_create('9999-12-31')->format('M-d-Y');
Dec-31-9999
php > echo date_create('10000-1-01')->format('M-d-Y');
Jan-01-2000
-nathan
--- End Message ---
--- Begin Message ---
On Wed, 2008-05-07 at 00:54 -0600, Nathan Nobbe wrote:
> looks like mine only goes to dec. 31, 9999 =/
>
*Gasp!* best you get cracking on finding an alternative solution!
--Paul
All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
--- End Message ---
--- Begin Message ---
-----Original Message-----
From: Paul Scott [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 07, 2008 9:12 AM
To: Nathan Nobbe
Cc: Kalle Sommer Nielsen; Jon L.; Chetan Rane; [EMAIL PROTECTED]
Subject: Re: [PHP] the Y2K38 BUG
On Wed, 2008-05-07 at 00:54 -0600, Nathan Nobbe wrote:
> looks like mine only goes to dec. 31, 9999 =/
>
*Gasp!* best you get cracking on finding an alternative solution!
--Paul
I'm building my apps for my
grand-grand-grand-grand-grand-grand-grand-grand-grand-grand-grand-grand-gran
d-grand-grand-grand-grand-grand-grand-grand-grand-grand-grand-grand-grand-gr
and-grand-grand- children, so I better get on this :op
-- Chris
http://www.burning-turf.com http://www.phpstop.com
There is much pleasure to be gained from useless knowledge.
Bertrand Rusell
--- End Message ---
--- Begin Message ---
On Wed, May 7, 2008 at 1:11 AM, Paul Scott <[EMAIL PROTECTED]> wrote:
>
> On Wed, 2008-05-07 at 00:54 -0600, Nathan Nobbe wrote:
>
> > looks like mine only goes to dec. 31, 9999 =/
> >
>
> *Gasp!* best you get cracking on finding an alternative solution!
yes, me and the rest of the immortal gang are all quite worried :O
-nathan
--- End Message ---
--- Begin Message ---
On Wed, May 7, 2008 at 11:34 AM, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
>
> On Wed, May 7, 2008 at 1:11 AM, Paul Scott <[EMAIL PROTECTED]> wrote:
>
> >
> > On Wed, 2008-05-07 at 00:54 -0600, Nathan Nobbe wrote:
> >
> > > looks like mine only goes to dec. 31, 9999 =/
> > >
> >
> > *Gasp!* best you get cracking on finding an alternative solution!
>
>
> yes, me and the rest of the immortal gang are all quite worried :O
It matters nil. We're all dead anyway. There's indisputable
evidence that "Crisis 38", as I've dubbed it, will be man's doom.
http://isawit.com/y2k38.php
--
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.
--- End Message ---
--- Begin Message ---
Hello,
on 05/06/2008 06:36 AM Nirmal Jayasinghe said the following:
> hello all,
>
> I'm trying to figure out a way to manipulate incoming email attachments with
> PHP. There'll be a special email address to which the emails with the
> attachments would be sent, with a number specified in the subject line. What
> I need to do is to grab the attachment (a photo), rename it with the number
> specified in the subject line, and move it onto a specific folder on the Web
> server [which will be running LAMP].
>
> I couldn't find any online material describing how to manipulate incoming
> mail attachments. Can someone give an idea?
You may want to try this MIME parser class. It can parse the e-mail
messages of any size and optionally save the attachments to files in a
directory of your choice.
http://www.phpclasses.org/mimeparser
If want to parse messages retrieved from a POP3 mailbox, you may also
want to use in conjunction this POP3 class which comes with a stream
wrapper that lets you access messages in the POP3 mailbox as if they
were files. You can use file names like this: pop3://pop.server.com/1 .
http://www.phpclasses.org/pop3class
When used in conjunction, these two classes allow you to extract
attachements from messages of any size without exceeding your PHP memory
limits.
--
Regards,
Manuel Lemos
PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--- End Message ---
--- Begin Message ---
Joe Harman wrote:
I am curious here if any of you are considering or already using
OpenID or Windows CardSpace? Does anyone see this being a big deal???
from a users stand point it seems like a big hassle to get started
with it and I'm not sure if it would scare people away or not? any
thoughts
I've been looking at some PHP scripts out there for OpenID... does
anyone have one to recommend???
With a bit of an upcoming rewrite of some of our user handling code, I
fully intend to support OpenID. I really like the idea and want to
promote it as much as possible.
Col
--- End Message ---
--- Begin Message ---
Yeah, after reading some about it yesterday and using it on some
sites, I like that it sort of simplifies some things for the end
user... it really fits sites like social networking stuff well.. I am
considering using this for our ecommerce site, it only becomes useful
though for repeat visitors though... which is what I want to make it
easy& convienent for those repeat customers
thanks for your input guys
Joe
On Wed, May 7, 2008 at 4:04 AM, Colin Guthrie <[EMAIL PROTECTED]> wrote:
>
> Joe Harman wrote:
>
> > I am curious here if any of you are considering or already using
> > OpenID or Windows CardSpace? Does anyone see this being a big deal???
> > from a users stand point it seems like a big hassle to get started
> > with it and I'm not sure if it would scare people away or not? any
> > thoughts
> >
> > I've been looking at some PHP scripts out there for OpenID... does
> > anyone have one to recommend???
> >
>
> With a bit of an upcoming rewrite of some of our user handling code, I
> fully intend to support OpenID. I really like the idea and want to promote
> it as much as possible.
>
> Col
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Joe Harman
SCP Performance Parts Warehouse
3475 High Ridge Blvd
High Ridge, MO 63049
Office : (636) 677-1320
Cell : (269) 277-0717
http://www.scpracingparts.com
--- End Message ---
--- Begin Message ---
Hi Guys,
We have a project where by we have a map in ai format (vector format). What
we want to do is to programmatically come up with a solution that say on the
map there is a restaurant at a certain location, that we can zoom into the
map on that specific area.
I really am not sure where to start. I guess image maps arent going to work
are they?
Should I be using the GD library for manipulating the images and doing
zooming? Also will the ai format be supported?
Please guys, any tips, links or help is appreciated.
TIA
Angelo
--- End Message ---
--- Begin Message ---
Angelo Zanetti wrote:
Hi Guys,
We have a project where by we have a map in ai format (vector format). What
we want to do is to programmatically come up with a solution that say on the
map there is a restaurant at a certain location, that we can zoom into the
map on that specific area.
I really am not sure where to start. I guess image maps arent going to work
are they?
Should I be using the GD library for manipulating the images and doing
zooming? Also will the ai format be supported?
Hi Angelo,
I can't find anywhere what this is about? Is it a web based solution? Is
it an desktop application? Is it console based?
--
Aschwin Wesselius
/'What you would like to be done to you, do that to the other....'/
--- End Message ---
--- Begin Message ---
_____
From: Aschwin Wesselius [mailto:[EMAIL PROTECTED]
Sent: 07 May 2008 12:21
To: Angelo Zanetti
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] AI file and mapping with PHP
Angelo Zanetti wrote:
Hi Guys,
We have a project where by we have a map in ai format (vector format). What
we want to do is to programmatically come up with a solution that say on the
map there is a restaurant at a certain location, that we can zoom into the
map on that specific area.
I really am not sure where to start. I guess image maps arent going to work
are they?
Should I be using the GD library for manipulating the images and doing
zooming? Also will the ai format be supported?
Hi Angelo,
I can't find anywhere what this is about? Is it a web based solution? Is it
an desktop application? Is it console based?
Hi Aschwin,
Yes it will be a web based solution.
Thanks
Angelo
--- End Message ---
--- Begin Message ---
On Wed, 2008-05-07 at 12:17 +0200, Angelo Zanetti wrote:
> We have a project where by we have a map in ai format (vector format). What
> we want to do is to programmatically come up with a solution that say on the
> map there is a restaurant at a certain location, that we can zoom into the
> map on that specific area.
>
Angelo,
You will need a specialised solution for this, like UMN Mapserver with
PHP/Mapscript. If you need some real, local, help, mail me off list, and
I will see about you guys paying me to do this for you (at SA prices) ;)
Seriously though, you won't get what you want with GD...
--Paul
All Email originating from UWC is covered by disclaimer
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
--- End Message ---
--- Begin Message ---
Quoting Angelo Zanetti <[EMAIL PROTECTED]>:
Hi Guys,
We have a project where by we have a map in ai format (vector format). What
we want to do is to programmatically come up with a solution that say on the
map there is a restaurant at a certain location, that we can zoom into the
map on that specific area.
I really am not sure where to start. I guess image maps arent going to work
are they?
Should I be using the GD library for manipulating the images and doing
zooming? Also will the ai format be supported?
Please guys, any tips, links or help is appreciated.
TIA
Angelo
I think doing something like this with GD is nearly impossible.
But you could import the vector image in flash/flex. Draw an invisible
grid over it to create some sort of long / lat coordinats.
Or maybe just move to the google / yahoo map API's.
--- End Message ---
--- Begin Message ---
Hi,
I have this Apache server with mod_vhost_alias and set /home/pages/%0
as the VirtualDocumentRoot
In /home/pages/gamito.foo.com I have a index.php file. This generates
the http://gamito.foo.com URL.
Also, I have a /home/pages/fckeditor with FCKeditor. *This is not
defined as a subdomain in the DNS*
I need to include in my index.php the file /home/pages/fckeditor/fckeditor.php
I have:
@define('FCKEDITOR_BASE', dirname(__FILE__));
require FCKEDITOR_BASE . '/../fckeditor/fckeditor.php';
But no good, Apache says it can't find the file:
/home/pages/gamito.foo/fckeditor/fckeditor.php
So, there's a "gamito" hanging wrongly in the request.
How can I solve this ?
Any help woud be appreciated.
Warm Regards,
Mário Gamito
--- End Message ---
--- Begin Message ---
Mário Gamito wrote:
Hi,
I have this Apache server with mod_vhost_alias and set /home/pages/%0
as the VirtualDocumentRoot
In /home/pages/gamito.foo.com I have a index.php file. This generates
the http://gamito.foo.com URL.
Also, I have a /home/pages/fckeditor with FCKeditor. *This is not
defined as a subdomain in the DNS*
I need to include in my index.php the file /home/pages/fckeditor/fckeditor.php
I have:
@define('FCKEDITOR_BASE', dirname(__FILE__));
require FCKEDITOR_BASE . '/../fckeditor/fckeditor.php';
Hi,
Try this '../fckeditor/fckeditor.php'
--
Aschwin Wesselius
/'What you would like to be done to you, do that to the other....'/
--- End Message ---
--- Begin Message ---
At 12:16 PM -0400 5/6/08, Travis L. Font wrote:
Following files:
bg.png - Clear Transparent Image
14416fed5d4f78.jpg - Normal Jpeg Image
The Code:
header('content-type: image/png');
$watermark = imagecreatefromjpeg('14416fed5d4f78.jpg');
$watermark_width = imagesx($watermark);
$watermark_height = imagesy($watermark);
$image = imagecreatetruecolor($watermark_width, $watermark_height);
$image = imagecreatefrompng('bg.png');
$size = getimagesize('bg.png');
$dest_x = $size[0] - $watermark_width - 5;
$dest_y = $size[1] - $watermark_height - 5;
imagecopymerge($image, $watermark, $dest_x,
$dest_y, 0, 0, $watermark_width,
$watermark_height, 100);
imagepng($image);
imagedestroy($image);
imagedestroy($watermark);
The Problem:
The code above works fine in sense of syntax!
bg.png acts as a transparent border for
14416fed5d4f78.jpg to keep the size of bg.png
and not the size of 14416fed5d4f78.jpg so it
doesn't blow up 14416fed5d4f78.jpg. However, the
image comes out black/white and has lost its
color!
I looked all over Google and I've found nothing
so far that's functional to give the new created
png file the correct colors as the original
14416fed5d4f78.jpg. I figure that I'm missing
some small elements to the process of creating
the png
Anyone have any ideas, pointers, advice, or
correct solution to make this possible?
Travis:
Try this:
$original=imagecreatefromjpeg("mydog.jpg");
$watermark=imagecreatefrompng("copyright.png");
$osx=imagesx($original);
$osy=imagesy($original);
$wsx=imagesx($watermark);
$wsy=imagesy($watermark);
imagecopy($original, $watermark, ($osx-$wsx)/2,
($osy-$wsy)/2, 0, 0, $wsx, $wsy); //center
imagepng($original, "trans.png");
The code works here:
http://webbytedd.com/b/watermark/
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
At 1:49 PM -0400 5/6/08, Robert Cummings wrote:
On Tue, 2008-05-06 at 13:42 -0400, tedd wrote:
> Rob, who I respect greatly, said that 90 percent of what you are
doing should be decided before you start programming. But, I never
work that way either.
I always jump right in and use the computer to design stuff. I never
resort to making a story-book layout or poster board work-up or
anything like that. I just don't work that way.
I don't do much of that either unless I want to sort some complex things
out that aren't easy to visualize in my head. When I say 90% of your DB
should be designed before you start writing code... well, I usually
thinking about the create statements (I guess some people might call
those code), not drawing charts :)
Occasionally I scribble down ideas I want to include, but normally I
just go right to the keyboard and outline what I want to do in the
comments of the code. I fill in the code later.
In school, my teachers wanted flow-charts with symbols on them -- but
considering we only had rocks to program with (i.e., one symbol),
there was not much difference between the flow-chart and the program.
So, I bypassed the design and went straight to programming. Old
habits die hard.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Hi,
I am having issues compiling php5.2.3 with Sybase 15. After much
troubleshooting, I was able to compile it with sybase12.5. But since we are
upgrading our system to Sybase 15. I need php5.2.3 to run with this version
of sybase. During my web search I found out that the library files php
uses/calls are different to the ones in Sybase15.
The article is from the bugs.php.net site:
http://bugs.php.net/bug.php?id=36516
I also followed a few suggestions regarding sybase directly from the php
site i.e.:
http://us.php.net/manual/en/ref.sybase.php
But none of the suggestions in the page above got me any results. If any one
else has any ideas/suggestions as to how to get php working with the new
Sybase/OCS-15_0 library files, it will greatly appreciated.
Thanks.
Lorena.
--- End Message ---
--- Begin Message ---
I need to determine if a file is truly deletable by a php script, Deleting permissions seem to be
the same as writing, they probably have the same criteria.
is_writable() seems to virtually useless in most cases. It doesn't take into account the directory
ownership/permissions; which, best I can tell, is the real determining factor.
I've resorted to having to determine the directory's ownership and then compare the directory's
rights with the owner's and then the other ['world'].
E.g., Assume my script was loaded with ftp, so it's ownership is the site-name, and I want the scrip
to be able to determine if it can delete a file. Thus, the file in question must have its "other"
permissions include write.
Surely, there must be an easier way.
Thanks, Al........
--- End Message ---
--- Begin Message ---
Al wrote:
I need to determine if a file is truly deletable by a php script,
Deleting permissions seem to be the same as writing, they probably
have the same criteria.
is_writable() seems to virtually useless in most cases. It doesn't
take into account the directory ownership/permissions; which, best I
can tell, is the real determining factor.
I've resorted to having to determine the directory's ownership and
then compare the directory's rights with the owner's and then the
other ['world'].
E.g., Assume my script was loaded with ftp, so it's ownership is the
site-name, and I want the scrip to be able to determine if it can
delete a file. Thus, the file in question must have its "other"
permissions include write.
Surely, there must be an easier way.
Thanks, Al........
Hi,
Maybe this is what you need:
http://nl.php.net/manual/en/function.fileperms.php
--
Aschwin Wesselius
/'What you would like to be done to you, do that to the other....'/
--- End Message ---
--- Begin Message ---
You are missing the point of my question. I don't have a problem reading the permissions. They do
not solely determine whether a file can be deleted.
Aschwin Wesselius wrote:
Al wrote:
I need to determine if a file is truly deletable by a php script,
Deleting permissions seem to be the same as writing, they probably
have the same criteria.
is_writable() seems to virtually useless in most cases. It doesn't
take into account the directory ownership/permissions; which, best I
can tell, is the real determining factor.
I've resorted to having to determine the directory's ownership and
then compare the directory's rights with the owner's and then the
other ['world'].
E.g., Assume my script was loaded with ftp, so it's ownership is the
site-name, and I want the scrip to be able to determine if it can
delete a file. Thus, the file in question must have its "other"
permissions include write.
Surely, there must be an easier way.
Thanks, Al........
Hi,
Maybe this is what you need:
http://nl.php.net/manual/en/function.fileperms.php
--- End Message ---
--- Begin Message ---
On 07/05/2008, Al <[EMAIL PROTECTED]> wrote:
> I need to determine if a file is truly deletable by a php script, Deleting
> permissions seem to be
> the same as writing, they probably have the same criteria.
You're not writing to the file, you're unlinking it from the
containing directory, so it's the directory's permissions that matter,
not the file's.
All you really need to do is check that the directory is_writable()
is_writable(dirname($filename));
-robin
--- End Message ---
--- Begin Message ---
If it's not, what else can? I got curious.
Regards,
Thiago Henrique Pojda
-----Mensagem original-----
De: Al [mailto:[EMAIL PROTECTED]
Enviada em: quarta-feira, 7 de maio de 2008 12:25
Para: [EMAIL PROTECTED]
Assunto: Re: [PHP] How to determine if file is writable and deletable
You are missing the point of my question. I don't have a problem reading the
permissions. They do
not solely determine whether a file can be deleted.
Aschwin Wesselius wrote:
> Al wrote:
>> I need to determine if a file is truly deletable by a php script,
>> Deleting permissions seem to be the same as writing, they probably
>> have the same criteria.
>>
>> is_writable() seems to virtually useless in most cases. It doesn't
>> take into account the directory ownership/permissions; which, best I
>> can tell, is the real determining factor.
>>
>> I've resorted to having to determine the directory's ownership and
>> then compare the directory's rights with the owner's and then the
>> other ['world'].
>>
>> E.g., Assume my script was loaded with ftp, so it's ownership is the
>> site-name, and I want the scrip to be able to determine if it can
>> delete a file. Thus, the file in question must have its "other"
>> permissions include write.
>>
>> Surely, there must be an easier way.
>>
>> Thanks, Al........
>>
> Hi,
>
> Maybe this is what you need:
>
> http://nl.php.net/manual/en/function.fileperms.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Dear PHP List,
PHP 5, Apache2, MySQL 5, running on Ubuntu, viewing & deving with
FireFox and Konqueror (Linux).
I am building a site with multiple tools and want to pass variables
throughout them all. Before, I was passing variables using <hidden> HTML
Form tags, but the site has grown too large for this tactic, so I went to
using $_SESSION. However, when I started using $_SESSION, my site loads 3-5
times slower then before. A page that queried MySQL and built itself in 3-5
seconds was now taking 15-20. While more has changed then just $_SESSION,
it is really the only significant difference.
Is $_SESSION slowing down my site? Is there a faster alternative to
global variables then using $_SESSION? Are using regular cookies faster?
Any help is appreciated.
Thanks,
Scott
--
Scott Campbell
"If you do what you've always done, you'll get what you've always gotten."
"Courage is resistance to fear .. not absence of fear."
--- End Message ---
--- Begin Message ---
On Wed, 2008-05-07 at 12:27 -0400, Scott Campbell wrote:
> Dear PHP List,
>
> PHP 5, Apache2, MySQL 5, running on Ubuntu, viewing & deving with
> FireFox and Konqueror (Linux).
>
> I am building a site with multiple tools and want to pass variables
> throughout them all. Before, I was passing variables using <hidden> HTML
> Form tags, but the site has grown too large for this tactic, so I went to
> using $_SESSION. However, when I started using $_SESSION, my site loads 3-5
> times slower then before. A page that queried MySQL and built itself in 3-5
> seconds was now taking 15-20. While more has changed then just $_SESSION,
> it is really the only significant difference.
>
> Is $_SESSION slowing down my site? Is there a faster alternative to
> global variables then using $_SESSION? Are using regular cookies faster?
>
> Any help is appreciated.
How are your sessions implemented? Are you using the stock PHP session
functionality or did you cook your own solution? I can't see the stock
PHP solution adding anything more than a split second to your page time.
The exception being when it performs cleanup. Cleanup should be
relegated to a cron job. Have you added anything new to the database?
new query perhaps on a large table that doesn't make use of indexes?
Small changes can have a bigger impact than large changes depending on
what exactly changed.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
---- Scott Campbell <[EMAIL PROTECTED]> wrote:
> Dear PHP List,
>
> PHP 5, Apache2, MySQL 5, running on Ubuntu, viewing & deving with
> FireFox and Konqueror (Linux).
>
> I am building a site with multiple tools and want to pass variables
> throughout them all. Before, I was passing variables using <hidden> HTML
> Form tags, but the site has grown too large for this tactic, so I went to
> using $_SESSION. However, when I started using $_SESSION, my site loads 3-5
> times slower then before. A page that queried MySQL and built itself in 3-5
> seconds was now taking 15-20. While more has changed then just $_SESSION,
> it is really the only significant difference.
>
> Is $_SESSION slowing down my site? Is there a faster alternative to
> global variables then using $_SESSION? Are using regular cookies faster?
>
> Any help is appreciated.
>
> Thanks,
> Scott
Did you add any includes and are they include or include_once or require VS.
require_once?
I found stress tests that show that an include is faster then an include_once
and so removing the _once from includes and requires will speed up your site.
HTH,
Wolf
--- End Message ---
--- Begin Message ---
Hey,
<clip>
$tag_regex=array(
'/\<p(\s*)\>(.*?)\<\/p\> /si' => "$1",
'/\<(\s*)(*.?)class\=(*.?)\>(.*?)\<\/(*.?)\>/si' => "$3"
);
$paragraphs=preg_replace(array_keys($tag_regex),array_values($tag_regex),$page);
I am not sure what tag is that you mean on <class="something">, but in this
RE .. it should capture any <p> tags (the first element of the array) and
any tags (the second element of the array) that has attribute class on it.
</clip>
Thanks for replying!
Sorry, a bit of a typo there, i meant <p class="something">
I ran your regex but got this warning:
Warning: preg_replace() [function.preg-replace]: Compilation failed: nothing
to repeat at offset 8 in C:\xampp2\htdocs\ezee\tests\para_regex.php on line 25
I think I ran it wrong, because although i have passed $page i dont know where
to pass the replacement texts...
Can you give me an example on how to run this or an explanation?
Thanks!
R
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
--- End Message ---