Thinkphp 之 表單令牌錯誤

今天發現了一個很有意思的事情,就是打開子窗口時改變了 __hash__ 值,因爲子窗口當中有表單

//+---------------------------------------------------
//| 打開模式窗口,返回新窗口的操作值
//+---------------------------------------------------
function PopModalWindow(url,width,height)
{
var result=window.showModalDialog(url,"win","dialogWidth:"+width+"px;dialogHeight:"+height+"px;center:yes;status:no;scroll:no;dialogHide:no;resizable:no;help:no;edge:sunken;");
return result;
}


表單代碼如下

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<TITLE>權限組挑選</TITLE>
<load type="css" href ="../Public/css/style.css" />
<script type="text/javascript">
<!--
function ok(){
var result = new Array();
var obj   = form1.group.options;
var j=0;
for(var i=0;i<obj.length;i++){
if (obj[i].selected==true){
result[j] = new Array();
result[j][0] = obj[i].text;
result[j][1] = obj[i].value;
j++;
}
}
window.returnValue=result;
window.close(); 
}

//-->
</SCRIPT>
<base target="_self" />
</HEAD>

<BODY style="margin:0;overflow:hidden">
<FORM METHOD="POST" style="margin:0" name = "form1" ACTION="">
<div align="center">
<TABLE class="order" cellpadding=0 style="margin:0" cellspacing=0 width="100%">
<tr><td height="5" colspan="2" class="topTd" ></td></tr>
<TR>
<Th colspan=2 align="center"><div class="fLeft"><input name="name" type="text" style="width:165px"></div>
<html:imageBtn name="search" value="查詢" click="form1.submit()" style="impBtn hMargin fLeft " /></Th>
</TR>
<TR >
<TD width="75%" align="right">
<div class="solid">
<SELECT class="multiSelect" ondblclick="ok()" name="group" size="15">
<option value="0">無上級組</option>
<voList name="list" id="group" >
<option value="{$group.id}">{$group.name}</option>
</voList>
</SELECT></div></TD>
</TR>
<TR>
<TD colspan=2 align="center">
<div style="width:65%">
<input type="submit" value="確 定" class="submit hMargin " /> 
<input name="reset" type="reset" value="取 消" onclick="window.close()" class="submit small " />
{__NOTOKEN__}
</div>
</TD>
</TR>
<tr><td height="5" colspan="2" class="topTd" ></td></tr>
</TABLE>
</div>
</FORM>
</html>


紅色部分是我的解決方案  ,爲了不改變 session 值,子窗口中的表單,不能讓它自動生成 __hash__ 令牌驗證的 session 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章