public static function account_validate($username, $firstname, $lastname, $email) { $user = new Access(); if (empty($username)) { validate::$er_message = '<i style="color: red;">Username field cannot be left empty</i><br/>'; return false; } if (empty($email)) { validate::$er_message .= '<i style="color: red;">Email field cannot be left empty</i><br/>'; return false; } if (empty($firstname)) { return true; } if (strlen($firstname) > 10 || strlen($firstname) < 2) { validate::$er_message = '<i style="color: red;">First name must be greater the 2 characters and less the 10 characters long! </i><br/>'; return false; } if (is_numeric($firstname)) { validate::$er_message = '<i style="color: red;">First name must be letters only!</i><br/>'; return false; } if (empty($lastname)) { return true; } if (strlen($lastname) > 10 || strlen($lastname) < 2) { validate::$er_message = '<i style="color: red;">Last name must be greater the 2 characters and less the 10 characters long! </i><br/>'; return false; } if (is_numeric($lastname)) { validate::$er_message = '<i style="color: red;">Last name must be letters only!</i><br/>'; return false; } if (User::ifUserExist($email) == true && $email == $user->get_email($_SESSION['uid'])) { return true; } elseif (User::ifUserExist($email) == true && $email !== $user->get_email($_SESSION['uid'])) { validate::$er_message = '<i style="color: red;">Someone else is already using that email address!</i><br/>'; return false; } if (Validate::is_valid_email($email) == false) { validate::$er_message .= '<i style="color: red;">Please enter a valid email address!</i><br/>'; return false; } else { return true; } }