Skip to content

Commit

Permalink
double redirect prevention - if both 'meta http-equiv' and javascript…
Browse files Browse the repository at this point in the history
… redirects are used, javascript delay is 3 seconds longer to prevent accidental double redirects. The target page can still be loaded twice in case user clicks the link before the target page gets fully loaded.
  • Loading branch information
skodak committed Sep 7, 2006
1 parent 5d3e0e8 commit 42d6be3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -4579,7 +4579,9 @@ function redirect($url, $message='', $delay=-1) {
$delay = 3; // if no delay specified wait 3 seconds
}
if (! defined('HEADER_PRINTED')) {
// this type of redirect might not be working in some browsers - such as lynx :-(
print_header('', '', '', '', '<meta http-equiv="refresh" content="'. $delay .'; url='. $encodedurl .'" />');
$delay += 3; // double redirect prevention, it was sometimes breaking upgrades before 1.7
}
echo '<center>';
echo '<p>'. $message .'</p>';
Expand All @@ -4593,7 +4595,7 @@ function redirect($url, $message='', $delay=-1) {
function redirect() {
document.location.replace('<?php echo $surl ?>');
}
setTimeout("redirect()", <?php echo (($delay * 1000) + 300) ?>);
setTimeout("redirect()", <?php echo ($delay * 1000) ?>);
-->
</script>
<?php
Expand Down

0 comments on commit 42d6be3

Please sign in to comment.