darkfreaks Posted February 11, 2008 Share Posted February 11, 2008 is there a way to make sure in the following function that if emptyto stop it from inserting? it only checks for if isset. <?php ///------> the following lines are the code i think it is /** * These next lines will retrieve the necessary fields. These include username, * password & confirmation, email & confirmation and possibly the security image. */ $username = (isset($_POST['username']) && $this->validate_username($_POST['username'])) ? $this->qls->Security->make_safe($_POST['username']) : false; $password = (isset($_POST['password']) && $this->validate_password ($_POST['password'])) ? $this->qls->Security->make_safe($_POST['password']) : false; $confirm_password = (isset($_POST['password_c']) && $_POST['password_c'] == $password) ? true : false; $email = (isset($_POST['email']) && strlen($_POST['email']) > 6 && strlen($_POST['email']) < 256 && eregi ('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+) *(\.[a-z]{2,3})$', $_POST['email'])) ? $this->qls->Security->make_safe($_POST['email']) : false; $confirm_email = (isset($_POST['email_c']) && $_POST['email_c'] == $email) ? true : false; if ($this->qls->config['security_image'] == 'yes') { // The random id of the image $random_id = (isset($_POST['random_id']) && preg_match ('/^[a-fA-F0-9]{40}$/', $_POST['random_id'])) ? $this->qls-> Security->make_safe($_POST['random_id']) : false; // The security code entered by the user $security_code = (isset($_POST['security_code']) && preg_match('/[a-zA-Z1-9]{5,8}/', $_POST['security_code'])) ? $_POST['security_code'] : false; if ($this->qls->Security->check_security_image($random_id, $security_code)) { $security_check = true; } } else { $security_check = true; } if ($username === false) { $this->register_error = REGISTER_USERNAME_ERROR; return false; } if ($this->check_username_existance($username)) { $this->register_error = REGISTER_USERNAME_EXISTS; return false; } if ($password === false || $confirm_password === false) { $this->register_error = REGISTER_PASSWORD_ERROR; return false; } if ($email === false || $confirm_email === false) { $this->register_error = REGISTER_EMAIL_ERROR; return false; } if ($security_check === false) { $this->register_error = REGISTER_SECURITY_ERROR; return false; } $this->insert_registration_data($username, $password, $email, $save); return true; } ///<--------------------end ?> Link to comment https://forums.phpfreaks.com/topic/90426-class-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.