wakey
wakey

Reputation: 2409

Bypass chrome "this website has a redirect loop" error?

I am trying to develop some sort of automated inserting system in my database and for it to work I need to redirect back to the same page about 2400 times. This page is intended for a one-time-use and after it has edited every row of my database I intend to delete it.

I was wondering if anyone knew how to disable or bypass the Google Chrome "this website has a redirect loop" error page. I know there is a redirect loop, it is there by design (because I cant think of any way else to do this).

Here is the code as it stands currently:

<?php
include "db/connect.php";
include "db/select.php";
include "functions/getStatics.php";
error_reporting(E_ALL | E_WARNING | E_NOTICE);

if(isset($_GET['pos'])) {
    $id = $_GET['pos'];
} else {
    $id = 1;
}

$all = dbSelect("SELECT * FROM wh_systems WHERE id = $id");



$name = $all[0]->name;
$id = $all[0]->id;
$statics = getStatics($name);

echo $name.' - '.$id.' - '.$statics;

$sql = "UPDATE wh_systems
        SET statics='$statics'
        WHERE id=$id";

$update = $db->query($sql);
$location = "?pos=".($id+1);
header("Location: " . "http://" .$_SERVER['HTTP_HOST'].'/'. $_SERVER['PHP_SELF'] . $location);

When I run it, only about 22 rows (or 22 redirects) before the page halts and spits up the error.

Let me know if you know of any workarounds for this issue,

Thanks.

Upvotes: 2

Views: 1185

Answers (1)

Arie
Arie

Reputation: 680

This probably works:

<?php
echo '<meta http-equiv="refresh" content="0; url=http://' .$_SERVER['HTTP_HOST'].'/'. $_SERVER['PHP_SELF'] . $location.'">';
?>

Upvotes: 4

Related Questions