Re: [請益] 關於傳遞變數
※ 引述《Jim33 (龍龍)》之銘言:
: 我看到版上有很多前人傳遞變數的方法,
: 一種是把參數掛在網頁上傳遞的時候,
: 例如:http://xxxxxx/xxxx?id=2
: 取值的時候就是用$_GET['id']
: 另外一種方法是(我不會講,用程式表示)
: 這一部份應該是html的語法
: <form method="POST" action="xx.php">
: <input type="submit" name="id" value="2">
: </form>
這個也是可以用的..
<form method="POST" action="xx.php" name='form'>
<input type='hidden' name='name' value='xxxx'>
<input type='hidden' name='password' value='xxxx'>
<input type='submit' style='display:none'>
</form>
<script type='text/javascript'>
// 按下去.. kukuku
document.forms.form.submit();
</script>
這樣就會「按下去」了..
按鈕那一行 html 一定要有, 不然 Firefox 會有錯誤。
建議把密碼用 md5 編碼後再放到 html 上面來傳遞。
如果希望安全一點, 可以在程式中事先設定一串東西..
例如:
$p = "w340mpdsdggp34ybmo"; // 胡打一通
$password = md5($_POST['password'].$p);
然後這個 $password 再放到 POST 或 GET 上面使用。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.166.133.20
推
07/18 11:54, , 1F
07/18 11:54, 1F
推
07/18 13:55, , 2F
07/18 13:55, 2F
→
07/18 13:56, , 3F
07/18 13:56, 3F
→
07/18 13:56, , 4F
07/18 13:56, 4F
→
07/18 13:57, , 5F
07/18 13:57, 5F
推
07/19 04:40, , 6F
07/19 04:40, 6F
推
07/21 08:22, , 7F
07/21 08:22, 7F
討論串 (同標題文章)