php-general Digest 4 Jan 2007 09:51:37 -0000 Issue 4550
Topics (messages 246491 through 246509):
Re: Port Block
246491 by: Richard Lynch
246496 by: Stut
Re: How to read cookies set by php?
246492 by: Richard Lynch
Re: E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
246493 by: Jochem Maas
Re: IE, Word documents and Content Types
246494 by: Richard Lynch
246495 by: Jochem Maas
246505 by: Roman Neuhauser
Calling static child method from inherited static parent method
246497 by: Kelly Jones
246499 by: Fahad Pervaiz
246506 by: Roman Neuhauser
Re: software recommendation: ServiceCapture
246498 by: Casey Chu
Re: Removing UTF-8 from text
246500 by: Dotan Cohen
246501 by: Chris
246503 by: Roman Neuhauser
246504 by: Dotan Cohen
Re: Temporary Emails - Your Recommendations - An Appeal to the PHP Community
246502 by: Shafiq Rehman
Help me about using php with tomcat server.
246507 by: Le Phuoc Canh
246508 by: Roman Neuhauser
246509 by: Iqbal Naved
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:
php-general@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
On Wed, January 3, 2007 2:44 pm, Christopher Deeley wrote:
> I used to use mailenable to send e-mails from a site hosted on my
> computer,
> to email anyone.
>
> Now my ISP blocked port 25 so I can't connect directly to any smtp
> servers
> like google to send e-mail directly from my computer.
>
> Does anyone know of an open SMTP server which doesn't use port 25?
Perhaps you could talk to gmail or google and find out how they've
solved this problem for their other million users...
Or, rather, search their sites for the answer, since it almost for
sure has to be there.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
Christopher Deeley wrote:
I used to use mailenable to send e-mails from a site hosted on my computer,
to email anyone.
Now my ISP blocked port 25 so I can't connect directly to any smtp servers
like google to send e-mail directly from my computer.
Does anyone know of an open SMTP server which doesn't use port 25?
In my experience ISPs do this to force you to use their SMTP server so
they can keep an eye on what you are doing. If that is the case all you
need to do is find out what their SMTP server details are and set up
your machine to send all mail through that.
If that is not the case, and your ISP has actually completely blocked
outgoing connections on port 25, I suggest you find a new ISP.
-Stut
--- End Message ---
--- Begin Message ---
On Wed, January 3, 2007 2:44 pm, Dotan Cohen wrote:
> On 03/01/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
>> On Wed, January 3, 2007 9:02 am, Dotan Cohen wrote:
>> > On 03/01/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
>> >> Configure the browser to prompt you before saving cookies, and
>> then
>> >> surf there again?
>> >
>> > FIrst thing that I did (well, second). The cookies are obfuscated.
>>
>> They won't get any clearer than that...
>>
>> What you see is what you get, which is what you'll see with all
>> these
>> methods.
>>
>
> No, I think that if I spoof the server via /etc/hosts then I'll be
> able to pull content out of the cookie. In my spare time....
The values you see in the cookie that way are the same values you'll
see in the headers is all I'm saying.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
Roman Neuhauser wrote:
> # [EMAIL PROTECTED] / 2007-01-03 16:43:14 +0100:
>> Roman Neuhauser wrote:
>>> # [EMAIL PROTECTED] / 2007-01-03 14:07:31 +0100:
....
>
> BTW, would you share a version of f($any) that meets your definition of
> good code?
I would suggest adding some sanity checking - as opposed to relying on
any kind of error trigger/trapping/catching mechanism.
the regard to the point of the possible/perceived cons of working with an
interpreted, dynamically typed language the post Gregory Beaver made make the
case much more clearly than I could have.
I'll leave this thread for what it is now, leave it to say that it's been
a very interesting discussion and I certainly appreciated your [Roman]
thoughtful examples & arguments.
rgds,
Jochem
>
>>>>> function f($any)
>>>>> {
>>>>> printf("%s\n", $any);
>>>>> }
>
>>>> true - but then it would force someone to use exceptions - the overall
>>>> consensus went against forcing that on people.
>>> I don't follow the logic. What did we gain? Can one of those "exceptions
>>> == Java, Java stinks, exceptions stink" campers show me their version of
>>> the below f($any) that works in 5.1 and 5.2?
>> probably not - i wouldn't know I don't live in that camp.
>
> That's why I didn't ask *you*. ;)
>
--- End Message ---
--- Begin Message ---
On Wed, January 3, 2007 2:52 pm, Philip Thompson wrote:
> I have a form where a user can upload different types of documents. A
> valid file type they will be able to upload is a Word Document.
> However, when I view the $_FILES 'type' of a word document in Internet
> Explorer, it says it's type 'application/octet-stream' instead of
> 'application/msword' or 'application/vnd.ms-word'. It works fine in
> Firefox and Safari.
>
> Any ideas why IE does this and/or how I might be able to get around
> this?
IE does this because MS is not interested in interoperability.
Note that application/octet-stream is valid for any kind of document
whatsoever for an upload. For output, that would require the browser
to download the document rather than attempt to display it. More on
that here:
http://richardlynch.blogspot.com/
> I know of 1 or 2 options for sort of bypassing this, but I'd
> like to hear from the group to see if there's a better,
> security-conscious idea.
The security-conscious idea is to IGNORE the 'type' in $_FILES,
because anybody could cram anything they want in to that, and send you
any kind of virus-laden warez document. :-)
Use Mime Magic or exec("file /path/to/upload", $output, $error) to
find out what kind of document they REALLY uploaded, regardless of
what they CLAIM it is in $_FILE['type']
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
hi Richard,
Best Wishes for the new year btw!
Richard Lynch wrote:
> On Wed, January 3, 2007 2:52 pm, Philip Thompson wrote:
>> I have a form where a user can upload different types of documents. A
>> valid file type they will be able to upload is a Word Document.
>> However, when I view the $_FILES 'type' of a word document in Internet
>> Explorer, it says it's type 'application/octet-stream' instead of
>> 'application/msword' or 'application/vnd.ms-word'. It works fine in
>> Firefox and Safari.
>>
>> Any ideas why IE does this and/or how I might be able to get around
>> this?
>
> IE does this because MS is not interested in interoperability.
>
> Note that application/octet-stream is valid for any kind of document
> whatsoever for an upload. For output, that would require the browser
> to download the document rather than attempt to display it. More on
> that here:
> http://richardlynch.blogspot.com/
>
>> I know of 1 or 2 options for sort of bypassing this, but I'd
>> like to hear from the group to see if there's a better,
>> security-conscious idea.
>
> The security-conscious idea is to IGNORE the 'type' in $_FILES,
> because anybody could cram anything they want in to that, and send you
> any kind of virus-laden warez document. :-)
>
> Use Mime Magic or exec("file /path/to/upload", $output, $error) to
> find out what kind of document they REALLY uploaded, regardless of
> what they CLAIM it is in $_FILE['type']
I guess this is not the time to bring up the discussion on including the
fileinfo PECL extension into the core as standard thats being waged on the
internals
mailing list (or that mime magic seems to have been magically relegated to the
dustbin)?
:-)
>
--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-01-03 15:48:31 -0600:
> On Wed, January 3, 2007 2:52 pm, Philip Thompson wrote:
> > I have a form where a user can upload different types of documents. A
> > valid file type they will be able to upload is a Word Document.
> > However, when I view the $_FILES 'type' of a word document in Internet
> > Explorer, it says it's type 'application/octet-stream' instead of
> > 'application/msword' or 'application/vnd.ms-word'. It works fine in
> > Firefox and Safari.
> >
> > Any ideas why IE does this and/or how I might be able to get around
> > this?
>
> IE does this because MS is not interested in interoperability.
Back this statements with some references, will you?
> Note that application/octet-stream is valid for any kind of document
> whatsoever for an upload. For output, that would require the browser
> to download the document rather than attempt to display it. More on
> that here:
> http://richardlynch.blogspot.com/
To the OP: read that rant for amusement, but don't use the "advice"
rlynch gives, it's nonsense. If you don't believe me, check the RFCs
yourself.
http://marc.theaimsgroup.com/?l=php-general&m=116626545820302&w=2
http://marc.theaimsgroup.com/?l=php-general&m=116649130605303&w=2
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
--- End Message ---
--- Begin Message ---
I'm trying to implement what I think is called a "virtual method": my
abstract parent class ParentClass defines a method xxx that calls
method yyy, but yyy is defined only in ParentClass's children.
I can't get this to work (PHP5.0.4). Sample code:
=== start sample code ===
abstract class ParentClass {
// xxx just returns 5 + whatever yyy() returns
public static function xxx () {return 5 + yyy();}
// all my children must define yyy()
abstract static function yyy();
}
abstract class ChildClass extends ParentClass {
public static function yyy () {return 7;}
}
echo ChildClass::xxx();
=== end sample code ===
When I run the above, I get this error:
Fatal error: Call to undefined function yyy() in <file> on line 9
Changing the call from yyy() to self::yyy() gives a different error:
Fatal error: Cannot call abstract method ParentClass::yyy() in <file> on line 9
How to do this correctly?
--
We're just a Bunch Of Regular Guys, a collective group that's trying
to understand and assimilate technology. We feel that resistance to
new ideas and technology is unwise and ultimately futile.
--- End Message ---
--- Begin Message ---
===ORIGINAL===
I'm trying to implement what I think is called a "virtual method": my
abstract parent class ParentClass defines a method xxx that calls
method yyy, but yyy is defined only in ParentClass's children.
I can't get this to work (PHP5.0.4). Sample code:
=== start sample code ===
abstract class ParentClass {
// xxx just returns 5 + whatever yyy() returns
public static function xxx () {return 5 + yyy();}
// all my children must define yyy()
abstract static function yyy();
}
abstract class ChildClass extends ParentClass {
public static function yyy () {return 7;}
}
echo ChildClass::xxx();
=== end sample code ===
When I run the above, I get this error:
Fatal error: Call to undefined function yyy() in <file> on line 9
Changing the call from yyy() to self::yyy() gives a different error:
Fatal error: Cannot call abstract method ParentClass::yyy() in <file> on
line 9
How to do this correctly?
===END ORIGINAL===
The following code works..Reasons:
1. both of your classes are abstract
2. In Parent class you cannot referr to yyy() or self::yyy() cause 'self'
points to the same class and calling yyy() searches for a global yyy()
function.
abstract class ParentClass {
// xxx just returns 5 + whatever yyy() returns
public function xxx () {
return 5 + $this->yyy();
}
// all my children must define yyy()
abstract function yyy();
}
class ChildClass extends ParentClass {
public function yyy ()
{
return 7;
}
}
$obj=new ChildClass;
echo $obj->xxx();
--
Regards
Fahad Pervaiz
www.ecommerce-xperts.com
(Shopping Cart, Web Design, SEO)
--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-01-03 19:14:31 -0700:
> I'm trying to implement what I think is called a "virtual method": my
> abstract parent class ParentClass defines a method xxx that calls
> method yyy, but yyy is defined only in ParentClass's children.
>
> I can't get this to work (PHP5.0.4). Sample code:
>
> === start sample code ===
>
> abstract class ParentClass {
> // xxx just returns 5 + whatever yyy() returns
> public static function xxx () {return 5 + yyy();}
> // all my children must define yyy()
> abstract static function yyy();
> }
>
> abstract class ChildClass extends ParentClass {
> public static function yyy () {return 7;}
> }
>
> echo ChildClass::xxx();
>
> === end sample code ===
>
> When I run the above, I get this error:
>
> Fatal error: Call to undefined function yyy() in <file> on line 9
>
> Changing the call from yyy() to self::yyy() gives a different error:
>
> Fatal error: Cannot call abstract method ParentClass::yyy() in <file> on
> line 9
>
> How to do this correctly?
Without "static". Chances are the code would be better served by an
instance anyway (static methods deprive you of polymorphism, as you just
found out.
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
--- End Message ---
--- Begin Message ---
I already have one, but this one looks better! I don't want to pay though...
On 1/2/07, Paul Novitski <[EMAIL PROTECTED]> wrote:
I've recently discovered a tool that I recommend for web work:
ServiceCapture by Kevin Langdon
http://kevinlangdon.com/serviceCapture/
It acts as an HTTP proxy, inserting itself between browser and the
net, and logs the details of http requests and responses.
It's been a great help to me lately while working on a PHP-Flash
dialog via AMF-PHP, and will undoubtedly save time on future projects
when I need to debug cookies and posts.
(This is a spontaneous, unsolicited, uninvested recommendation. I
just really like the software and thought you might find it useful.)
Regards,
Paul
__________________________
Juniper Webcraft Ltd.
http://juniperwebcraft.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On 03/01/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote:
It's for "Did you know that the syntax is described in the manual? Did
you know that PHP has a manual on the web? It's at http://www.php.net/".
Thank you Roman. Yes, I am familiar with the php manual. I've
referenced the manual hunderds of times, saving list posts. But
sometimes (especially in the course of regular expressions for me) one
needs to ask on the list. I am also aware that I am not the only one
with regex difficulties- they seem to be a sticky point for many noobs
like myself in all computer languages, not just php. Also, the Hebrew
translation of the manual is very difficult for me to grasp, so I use
the English version. That may not be a problem for you, but it is for
me.
Dotan Cohen
http://what-is-what.com/what_is/eula.html
http://technology-sleuth.com/short_answer/how_much_memory_will_i_need_for_my_digital_camera.html
--- End Message ---
--- Begin Message ---
Dotan Cohen wrote:
On 03/01/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
Instead of trying to strip the UTF stuff out, try to capture the part
you want:
preg_match_all('|<[^>]>|ms', $emails, $output);
var_dump($output);
Richard, I do have a working script now, but I'm intrigued by your
regex. Why do you surround the needle with pipes, and what is the "ms"
for?
http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php lists
what the modifiers do.
As others have mentioned, you can use anything as delimiters. Sometimes
it's easier to change the delimiter rather than worrying about escaping
it - for example when doing a regex for urls.. so instead of:
/http:\/\/ etc etc / (hard to read)
change the delimiters:
#http:// etc etc #
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-01-04 08:21:37 +0200:
> On 03/01/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote:
> >
> >It's for "Did you know that the syntax is described in the manual? Did
> >you know that PHP has a manual on the web? It's at http://www.php.net/".
> >
>
> Thank you Roman. Yes, I am familiar with the php manual. I've
> referenced the manual hunderds of times, saving list posts. But
> sometimes (especially in the course of regular expressions for me) one
> needs to ask on the list. I am also aware that I am not the only one
> with regex difficulties- they seem to be a sticky point for many noobs
> like myself in all computer languages, not just php. Also, the Hebrew
> translation of the manual is very difficult for me to grasp, so I use
> the English version. That may not be a problem for you, but it is for
> me.
Your written English is very good. If you can understand what you wrote
and can read replies (in English) from the list, you should have no
problems understanding the manual.
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
--- End Message ---
--- Begin Message ---
On 04/01/07, Roman Neuhauser <[EMAIL PROTECTED]> wrote:
Your written English is very good. If you can understand what you wrote
and can read replies (in English) from the list, you should have no
problems understanding the manual.
Thank you. Like said, I do prefer the English manual over the Hebrew
one. I'll not argue with you, rather, I was making the point that even
people who RTFM and STFA (like myself) need clarification and ask
questions.
Dotan Cohen
http://dotancohen.com/eng/israel_attacks.php
http://lyricslist.com/lyrics/lyrics/5/445/sepultura/schizophrenia.html
--- End Message ---
--- Begin Message ---
Hi,
You can use gmail account to receive as many mails as you want on different
email addresses with one account. For example my email address is
[EMAIL PROTECTED] I can receive email at [EMAIL PROTECTED] and
[EMAIL PROTECTED]
I love this feature especially when I am testing the signup process of any
web application bcoz usualy we do not allow users to create more than one
account with the same email address ;)
--
Shafiq Rehman
Zend Certified Engineer
http://phpgurru.com, http://shafiq.pk
On 1/3/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
On Mon, January 1, 2007 4:26 am, Jason Paschal wrote:
> i realize this isn't the appropriate mailing list and i risk being
> black-listed (flame, defamed, ignored, etc.).
>
> i occasionally use temporary emails when registering for forums or to
> get
> some shareware (we've all done it, don't give me that look, i have
> given
> what i could, when i could) and while i like the way mytrashmail.com
> works,
> i don't like having mytrashmail.com as part of the temp addy.
>
> does anyone know of a similar service that uses a more enticing
> domain?
Yahoo.com?
Hotmail.com?
Or, since you control your own domain name, presumably, use something
like:
[EMAIL PROTECTED]
when you give your email to jpaschal.com and use
[EMAIL PROTECTED]
when you give your email to example.com and...
You can set up your email with catchall, or you can just set up the
email alias for as long as you need it to exist, and nuke it later
or...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Dear all,
I have two web application running on php and jsp. But i don't know how can
to use php and jsp on tomcat server. Please help me.
thanks & best regard.
--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-01-04 15:05:54 +0700:
> I have two web application running on php and jsp. But i don't know how can
> to use php and jsp on tomcat server. Please help me.
Find an implementation of PHP in Java (tough luck) or the official
library wrapped in a JNI interface. But you'll make it a lot easier
on yourself if you just install Apache with PHP beside the Tomcat.
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
--- End Message ---
--- Begin Message ---
Hi,
The Tomcat server now includes the php javabridge, its a war file called
JavaBridge.war. Also, you can find this war file in
php-java-bridge.sourceforge.net . The instllation is pretty easy just copy
the war file in the root directory (e.g webapps/) and then run it from the
browser (eg. localhost/JavaBridge),
Hope this helps
Naved
On 1/4/07, Le Phuoc Canh <[EMAIL PROTECTED]> wrote:
Dear all,
I have two web application running on php and jsp. But i don't know how
can
to use php and jsp on tomcat server. Please help me.
thanks & best regard.
--- End Message ---