} if (empty($_POST['email'])) { $Empty[] = 'email'; } if (empty($_POST['description'])) { $Empty[] = 'description'; } if (long2ip(ip2long($_SERVER['REMOTE_ADDR'])) != $_SERVER['REMOTE_ADDR']) { echo 'Your IP address is not valid. '; die; } if (!empty($_FILES['picture']['tmp_name'])) { require 'inc/Avatar.php'; $Picture = new Avatar(); $picture_name = md5(time() . rand(0, 999)); if (!$Picture->move($_FILES['picture']['tmp_name'], $picture_name)) { $Invalid['picture'] = 'Something went wrong. Allowed images are JPG, GIF, PNG and max file size is 6 MB. Also note that there is a max width and height on 5000 pixels.'; $picture_name = NULL; } } else { $picture_name = NULL; } if (sizeof($Empty) == 0) { if (!is_numeric($_POST['lon'])) { $Invalid['lon'] = 'Failed to match a correct longitude pattern'; } if (!is_numeric($_POST['lat'])) { $Invalid['lat'] = 'Failed to match a correct latitude pattern'; } if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $Invalid['email'] = 'Invalid E-mail address';