window.open()打开错误的URL.浏览器会记住它直到注销


window.open() Opens wrong URL. Browser remembers it until logout

当我使用以下代码打开一个新窗口来创建新人时,它只工作一次:

<a class="special" href="#" onclick="window.open('http://www.myurl.blahblah/index_details.php?id=null&amp;page=1', 'personDetails', 'left=50, top=20, width=850, height=440, toolbar=no, scrollbars=no, statusbar=no');">New worker</a>

这个index_details.php用于显示一些人的详细信息数据,这取决于他/她的id,当我传递null时,它会创建一个新的数据,并使用头函数将其重定向到具有新id的自身。代码看起来不错,但我将其粘贴在下面:

<?php
require_once('start_session.php');
require_once('constant.data.php');
//**********************************************************************************//
$main = array();
$main_phrases = array(
                    'error' => iconv('windows-1250', 'utf-8', 'Error occur!')
                    );
$db = new DB();
//**********************************************************************************//
if ($_GET['id'] == "null")
    {
    $sql = 'INSERT INTO main_information (last_name, first_name, lastmod, lastentry) VALUES ("NEW","WORKER", CURRENT_DATE, CURRENT_DATE);';
    $result = $db->dbQuery($sql);
    $sql = 'SELECT MAX(id) AS lastId FROM main_information where last_name="NEW" and first_name="WORKER";';
    $result = $db->dbQuery($sql);
    $row = $db->dbFetchArray($result);
    $li = $row['lastId'];
    $sql = 'INSERT INTO additional_information (id_person, blacklist, medical_cert, application_ready, supervisor) VALUES ('.$li.',"N", "N", "N", "N");';
    $result = $db->dbQuery($sql);
    header('Location: ' . _MAIN_DOMAIN_ . 'index_details.php?id=' . $li . '&page=1');
    }
//**********************************************************************************//
if (isset($_FILES['face_photo']) && $_FILES['face_photo']['name'] != '' && $_GET['id'] != 'null' && $_GET['id'] != '')
    {
    $ext = substr($_FILES['face_photo']['name'], -4, 4);
    $fileName = 'photo' . $_GET['id'] . $ext;
    $uploadfile = SERVER_DIR . 'photo/' . $fileName;
    if (move_uploaded_file($_FILES['face_photo']['tmp_name'], $uploadfile)) 
        {
        $sql = 'UPDATE additional_information SET photo = "'.$fileName.'" WHERE id_person = '.intval($_GET['id']).';';
        if ($db->dbQuery($sql))
            header('Location: ' . _MAIN_DOMAIN_ . 'index_details.php?id=' . $_GET['id'] . '&page=1');
        }
    else    die('Uploaded file is incorrect!');
    }
//**********************************************************************************//
$smarty     = new Smarty;
$smarty->assign('main', $main);
$smarty->template_dir = SERVER_DIR.'tpl/';
$smarty->compile_dir = SERVER_DIR.'templates_c';
$smarty->cache_dir = SERVER_DIR.'cache';
$smarty->display('default_details.tpl');

?>

我的问题是,来自第一个片段的锚点只能工作一次。当我关闭personDetails窗口并想要创建新的人员时,它会打开以前创建的人员,而不是新的人员。问题发生在ie,chrome,FF直到我清除浏览器数据(什么注销我)。

即使我手动输入_http://www.mydomain.com.pl/admin/index_details.php?id=null&第1页例如,它将我重定向到_http://www.mydomain.com.pl/admin/index_details.php?id=1666&page=1不到_http://www.mydomain.com.pl/admin/index_details.php?id=1667&第1页(假设我刚刚创建了用户1666)。

这是由其他人写的CMS,我必须修复它。我想它可能是存储在会话、缓存、cookie中的东西,。。。有什么工具/线索可以找到并修复它吗?我不是每天都是网络开发人员。

我的客户声称它在一段时间前运行得很好,所以也许最近PHP、javascript或所有浏览器都出现了问题?

我终于找到了问题的答案。添加到index_details.php此代码:
header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-cache, must-revalidate" );
header( "Pragma: no-cache" );

帮助。

首先,我认为事实并非如此,因为我在页面中包含的一些html元标签中看到了这些标题。要求PHP在头之前再发送这些头("Location:…")会使浏览器忘记重定向。