darkfreaks Posted February 10, 2008 Share Posted February 10, 2008 ok i messed something up trying to add validation but can anyone see where i messed up? i will comment the lines that error. which is 163-165 and 319 i get headers cannot be moddified previously sent. ??? <?php /** * Checks the password code via the GET method * @return true if valid false if not */ function check_password_code() { $code = $this->qls->Security->make_safe($_GET['code']); $result = $this->qls->SQL->select('*', 'password_requests', array('code' => array( '=', $code ) ) ); $row = $this->qls->SQL->fetch_array($result); if ($row['id'] != '' && $row['used'] != 1) { return true; } else { return false; } } /** * This will actually change the password of the user * @return true on success, false on failure */ function change_password() { // A little extra security if ($this->check_password_code()) { $code = $this->qls->Security->make_safe($_GET['code']); // Retrieve the information from the database $result = $this->qls->SQL->select('*', 'password_requests', array('code' => array( '=', $code ) ) ); $row = $this->qls->SQL->fetch_array($result); // Get the user's username from the database $users_result = $this->qls->SQL->select('*', 'users', array('id' => array( '=', $row['user_id'] ) ) ); $users_row = $this->qls->SQL->fetch_array($users_result); $new_password = (isset($_POST['new_password']) && $this->validate_password($_POST['new_password'])) ? $this->qls->Security->make_safe($_POST['new_password']) : false; $new_password_confirm = (isset($_POST['new_password_confirm']) && $_POST['new_password_confirm'] == $_POST['new_password']) ? true : false; if ($new_password !== false && $new_password_confirm !== false) { $password_hash = $this->generate_password_hash($new_password, $users_row['username'], $users_row['code']); // Update the database $this->qls->SQL->update('users', array('password' => $password_hash), array('id' => array( '=', $row['user_id'] ) ) ); $this->qls->SQL->update('password_requests', array('used' => 1), array('id' => array( '=', $row['id'] ) ) ); return true; } else { $this->change_password_error = REGISTER_PASSWORD_ERROR; return false; //163 }//164 else {//165 $this->change_password_error = CHANGE_PASSWORD_INVALID_CODE; return false; } }?> and: <?php function validate_username($input) { if (preg_match($this->qls->config['user_regex'], $input)) { if (strlen($input) <= $this->qls->config['max_username'] && strlen($input) >= $this->qls->config['min_username']) { return true; } else { return false; } } else { return false; }//319 }?> Quote Link to comment Share on other sites More sharing options...
trq Posted February 10, 2008 Share Posted February 10, 2008 Did you read the sticky at the top of this board regarding header errors? Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 10, 2008 Author Share Posted February 10, 2008 yes i did ,i did not have tis issue before so therefore i think i may have messed up the code and im not sure where to look. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 10, 2008 Author Share Posted February 10, 2008 ob_start; does not fix the problem at all and i dont know where to look to fix the code ??? Quote Link to comment Share on other sites More sharing options...
revraz Posted February 10, 2008 Share Posted February 10, 2008 If you look at the error, it tells you where the Output is that is creating the error. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.