每日一题(13)

上一篇 / 下一篇  2007-10-23 21:44:26 / 个人分类:每日一题

3. Under normal circumstances—and ignoring any browser bugs—how can a cookie be accessed from a domain other than the one it was set for?

A. By consulting the HTTP_REMOTE_COOKIE header

B. It cannot be done

C. By setting a different domain when calling setcookie()

D. By sending an additional request to the browser

E. By using Javascrīpt to send the cookie as part of the URL

Answer:

Answer B is correct. Browsers simply do not allow an HTTP transaction that takes place on one domain to set cookies for another domain. Doing otherwise would present clear security implications: for example, a malicious page on one domain could overwrite your session ID for another domain and force you to use another session to which a third party has access without your knowledge.

 

4. How can the index.php scrīpt access the email form element of the following HTML form? (Choose 2)

<form action="index.php" method="post">

<input type="text" name="email"/> </form>

A. $_GET['email']

B. $_POST['email']

C. $_SESSION['text’]

D. $_REQUEST['email']

E. $_POST['text']

Answer:

Since the form’s method is post, the scrīpt will only be able to read the value through the $_POST and $_REQUEST superglobal arrays. The element’s name (email) is used as the key for the value in the array and, therefore, Answers B and D are correct. Note that, although perfectly valid from a logical perspective, the use of $_REQUEST should be discouraged because of potential security implications.


TAG: 每日一题

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

数据统计

  • 访问量: 16523
  • 日志数: 87
  • 建立时间: 2007-09-29
  • 更新时间: 2008-04-15

RSS订阅

Open Toolbar