0

I have an issue with php header location. I am trying to redirecting the page after a successful execution. But it is not redirecting. Also I have seo friendly url and I am not sure if it has anything to do with that as the problem started after that.

Code:

if (empty($_POST) === false && empty($errors) === true) {
                    change_password($session_user_id, $_POST['password']);
                    header('Location: user.php?p=changepassword&success');
                }

Above, change+password function works but the header does not. I also tried redirecting it to seo friendly url but still no luck. I have tested Header redirection on another test page, it works there fine. I have only problem on this password change and edit profile page.

Any clue why or how to find whats causing the issue?

Regards

Vurkac
  • 133
  • 8
  • 1
    http://php.net/manual/en/function.error-reporting.php probably outputting before header. – Funk Forty Niner Dec 09 '15 at 18:30
  • Please use PHP's [built-in functions](http://jayblanchard.net/proper_password_hashing_with_PHP.html) to handle password security. If you're using a PHP version less than 5.5 you can use the `password_hash()` [compatibility pack](https://github.com/ircmaxell/password_compat). – Jay Blanchard Dec 09 '15 at 18:31
  • I am already using password_hash() – Vurkac Dec 09 '15 at 18:32
  • which means this: Add error reporting to the top of your file(s) right after your opening PHP tag for example ` – Funk Forty Niner Dec 09 '15 at 18:36
  • header location php most before codes, `....` – user3612383 Dec 09 '15 at 18:36
  • basic debuggin: header() returns false on failure (e.g. headers already sent). don't just assume it'll succeed. – Marc B Dec 09 '15 at 18:36
  • OP probably doesn't want their question to be closed on account of just that @MarcB least, that's what I was first betting on. Let's see if my horse comes in first and by a nose. Edit: Looks like my horse came in. Love those 50 to 1 odds. – Funk Forty Niner Dec 09 '15 at 18:39
  • Warning: Cannot modify header information - headers already sent by (output started at /path/to/user.php:2) in /path/to/pages/user/changepassword.inc.php on line 48 user.php 2nd line is includes init.php and there is no header in init.php – Vurkac Dec 09 '15 at 18:39

0 Answers0