作者eecir (小君你最可愛了)
看板PHP
標題[請益] 不用cookie能做會員管理嗎
時間Tue Jul 18 16:19:51 2006
在關閉cookie的情況之下
變數要如何能在網頁中一直傳遞呢
例如登入後設userid
那是不是每個網頁都要去用post,get抓取變數呢
ex:
test1.php
$userid=john;
<? echo "<a href='test2.php?userid=".$userid."'>"; ?>
test2.php
echo $_GET["userid"]; //結果:john
<form id="form1" name="form1" method="POST" action="test3.php">
<input name="userid" type="text" id="userid" value="<?=$GET["userid"];?>"/>
<input name="Submit" type="submit" value="送出" />
test3.php
echo $_POST["userid"]; //結果:john
要每個網頁都這樣寫嗎??
有沒有不用cook比較好的寫法呢
不然變數豈不是要每個網頁都一直傳遞??
請大家多多幫忙
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.120.76.67
1F:推 alpe:session 07/18 16:22
2F:→ lazyhome:給樓上,使用者cookie關閉情況下,用session也沒有用 ... 07/18 16:52
3F:推 timyau:基本上一定是要用cookie的...不用好像不行... 07/18 21:30
4F:推 emn178:我都用資料庫來做session.. 07/19 01:37
5F:推 eecir:請問用資料庫來做session是什麼意思呢??有辦法詳細說明嗎 07/19 08:06
6F:推 alpe:給2F... ... session 就是為這種情況設計出來的 =.= 07/19 09:04
8F:→ cttlee:visitor accessing your web site is assigned an unique 07/19 09:38
9F:→ cttlee:id, the so-called session id. 07/19 09:39
10F:→ cttlee:This is either stored in a cookie on the user side 07/19 09:39
11F:→ cttlee:or is propagated in the URL. 07/19 09:39
12F:→ lazyhome:給1F,用session會產生一組cookie存在client端的電腦裡... 07/19 11:14
13F:→ lazyhome:所以把cookie關閉情況下,用session也沒有用.... 07/19 11:16
14F:推 alpe:你要不要看一下你樓上的最後一行... 用get... 07/19 13:44
15F:推 forgmonkey:session的sid除了用cookies也可以用SID環境變數get傳遞 07/23 20:26