Awesome...That worked! Thank you. I used the empty() function, however
moving the username db query to the end is what solved problem. The next
thing im trying to fix is to check file attachment for proper mime type
extension. Doesnt seem to work either, dies after password validation. It
does read through the photo validation because if i enter a username in db
then it does call $msg = "This username is taken, please choose a
different one.";
} elseif ($password != $password2) {
$focus = "password2";
$msg = "Passwords do not match.";
} elseif ($photo > 0) {
$ext = strtolower(substr($photo, -3));
if ($ext == "peg") { $ext = "jpg"; }
if ($ext != "gif" || $ext != "jpg" || $ext != "jpeg" || $ext != "bmp" )
{
$msg = "Please provide a valid gif, jpeg, or bmp photo";
}
if ($ltype == "1") { $type = "hotel"; }
if ($ltype == "2") { $type = "inn"; }
if ($ltype == "3") { $type = "bandb"; }
if ($ltype == "4") { $type = "resort"; }
$imgdir = "$DOCUMENT_ROOT/lodging/$type";
if (!file_exists($imgdir)) { mkdir($imgdir, 0755); }
$imgdir.= "/$account_id";
if (!file_exists($imgdir)) { mkdir($imgdir, 0755); }
move_uploaded_file($photo, "$imgdir/photo1.jpg");
if (file_exists("$imgdir/photo1.jpg")) {
$foo = '/usr/local/bin/convert -unsharp 1x1x1x1 -thumbnail 150x110
$imgdir/photo1.jpg $imgdir/photo2.jpg';
move("$imgdir/photo2.jpg", "$imgdir/photo1.jpg");
}
$addr = "Email Adress Here";
$subject = "Client #$account_id - Lodging Photo Uploaded";
$body = "Image located in: $imgdir/photo1.jpg";
mail($addr, $subject, $body);
} 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 (";