douzuan2814 2014-06-10 18:46
浏览 47
已采纳

绕过chrome“这个网站有一个重定向循环”错误?

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.

  • 写回答

1条回答 默认 最新

  • dou91855 2014-06-10 19:32
    关注

    This probably works:

    <?php
    echo '<meta http-equiv="refresh" content="0; url=http://' .$_SERVER['HTTP_HOST'].'/'. $_SERVER['PHP_SELF'] . $location.'">';
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播