Re: [PHP] alzheimers and confused

2001-11-18 Thread Joe Stump

if(!eregi(\.jpg$,$image) || !eregi(\.jpeg$,$image))
  die(ERROR: doesn't appear to be a JPeg image!);

--Joe

On Fri, Nov 16, 2001 at 09:45:07PM -0500, jtjohnston wrote:
 OK kids, I'm not 19 ... my old brain gets tired easily and my wife is
 complaining that I stay up too late PHPing :)
 Putting the rest aside, why does AND work and not OR. OR was what I
 meant?
 I meant ... if the string doesn't contain .jpg or the string doesn't
 contain .jpeg ...  ERROR!
 
 John
 
 ?php
 $errorfound = 0;
 $yourimage =
 
http://callisto.si.usherb.ca/~ang96m04/cgi-bin/postcards/e.jpegstrie/sap_bucket.jpg;;
 
 // if((!strpos($yourimage, .jpg)) or (!strpos($yourimage, .jpeg)))
  if((!strpos($yourimage, .jpg)) and (!strpos($yourimage, .jpeg)))
  {
   $errorfound++;
   echoYour image \font color=\00\$yourimage/font\br did
 not contain .jpg or .jpeg/b;
  }else{
   echoYour image \font color=\00\$yourimage/font\ contains
 .jpg or .jpeg/b;
  }
 
 ?
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

Joe Stump [EMAIL PROTECTED]

How would this sentence be different if pi equaled 3? 




msg40407/pgp0.pgp
Description: PGP signature


RE: [PHP] alzheimers and confused

2001-11-17 Thread Robert Klinkenberg

It depends on how you exactly formulated the test

// if((!strpos($yourimage, .jpg)) or (!strpos($yourimage, .jpeg)))
 if((!strpos($yourimage, .jpg)) and (!strpos($yourimage, .jpeg)))

THe first is 
  if !jpg or !jpeg 
while the second if statement tests for
  if !jpg and !jpeg

another way to test this is 
  if !(jpg or jpeg)

basicly the first one doesn't work because when the filename is jpg it isn't
jpeg so the code executes and when it's jpeg it isn't jpg, and again the
code will execute. the two other tests will correctly test if it's either
jpg or jpeg.

Robert Klinkenberg

-Oorspronkelijk bericht-
Van: jtjohnston [mailto:[EMAIL PROTECTED]]
Verzonden: Saturday, November 17, 2001 3:45 AM
Aan: [EMAIL PROTECTED]
Onderwerp: [PHP] alzheimers and confused


OK kids, I'm not 19 ... my old brain gets tired easily and my wife is
complaining that I stay up too late PHPing :)
Putting the rest aside, why does AND work and not OR. OR was what I
meant?
I meant ... if the string doesn't contain .jpg or the string doesn't
contain .jpeg ...  ERROR!

John


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]