Philip D Heady wrote:[color=blue]
>
> Tried && approach, didn't work. What gives?
>
> } elseif ($password != $password2) {
> $focus = "password2";
> $msg = "Passwords do not match.";
>
> } elseif ($photo) {
>
> $ext = strtolower(substr($photo_name, -3));
>
> if ($ext == "peg") { $ext = "jpg";
>
> } if ($ext != "gif" && $ext != "jpg" && $ext != "jpeg" && $ext
> !="bmp" ) {
>
> $focus = "photo";
> $msg2 = "Please provide a valid gif, jpeg, or bmp photo";
>
> } else {
>
> $photo_size = getimagesize($photo);
>
> if ($photo_size > 25000) {
>
> $msg2 = "Photo must be smaller than 25k.";
>
> }}} elseif ($username) {
>
> $q = "SELECT id FROM account WHERE username='". apos($username) ."'";
> $res = mysql_query($q);
> $num = mysql_num_rows($res);
>
> if ($num > 0) {
> $focus = "username";
> $msg = "This username is taken, please choose a different one.";
>
> }} else {
>
> $q = "INSERT INTO account (";[/color]
You mean you're still getting the same error message? If so, print out the
extension and name:
$msg2 = "Please provide a valid gif, jpeg, or bmp photo. Extension: $ext . Name:
$photo_name";
That should give you an idea why it's not matching. My guess is $photo_name is
not what you think it is. If so, try the $_FILES['filename']['name'] format.
And you might want to go with a regex for the IF statement. It's a bit
cleaner. I'm not sure if it'd be faster or not.
if (!preg_match("/(gif|jpeg|jpg|bmp)$/", $foo)) //<--UNTESTED
Shawn
--
Shawn Wilson
shawn@glassgiant.com http://www.glassgiant.com