//Checks if the email is valid //if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) // { $errors[] = 'Your email address does not appear to be valid.'; //} // if (preg_match('/^[a-zA-Z0-9]+$/i', $_POST['phone']) === 0) // { $errors[] = 'The phone you selected does not appear to be valid.';} // // if (preg_match('/^[a-zA-Z0-9]+$/i', $_POST['username']) === 0) // { $errors[] = 'Your username should contain letters only.'; //} // if (preg_match('/^[a-zA-Z0-9]+$/i', $_POST['password']) === 0) // { $errors[] = 'Your password should contain letters only.'; ////} //if there are no errors then it will add users to the database if (empty($errors)) { if (add_vehicles($_POST['manufacturer'], $_POST['model'], $_POST['category'], $_POST['year'], $_POST['price'], $_POST['kilometres'], $_POST['colour'], $_POST['registration'], $_POST['vin'], $_POST['cylinders'], $_POST['fuel'], $_POST['transmission']) === false) { $errors[] = 'Something went wrong, you may have already submitted your information.'; } /*mail_order($_POST['email']);*/ } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
break; case 'restore': if (isset($_GET['configid'])) { echo restore_configuration($_GET['configid']); } break; } } else { if (isset($_POST['add_vehicle'])) { $vehicle_name = $_POST['vehicle_name']; $vehicle_vin = $_POST['vehicle_vin']; $vehicle_type = $_POST['vehicle_type']; if ($vehicle_type == "-1") { echo "<font color='red'>Please select one vehicle type</font>"; } else { add_vehicles($vehicle_name, $vehicle_vin, $vehicle_type); } } else { if (isset($_GET['actionForVehicle'])) { // handle action request - show form switch ($_GET['actionForVehicle']) { case 'remove': if (isset($_GET['vehicleid'])) { remove_vehicle($_GET['vehicleid']); } break; } } else { if (isset($_POST['add_vehicle_to_association'])) { $user = wp_get_current_user(); $vehicle_id = $_POST['selected_vehicle'];