php+cookies

$date = gmstrftime("%A, %d-%b-%Y %H:%M:%S",(mktime()+6400) );
$HTTP_HOST = "www.chipchapin.com"; // our server's hostname

1:    header("Set-Cookie: testcookie1=present;");
2:    header("Set-Cookie: testcookie2=present; expires=$date");
3:    header("Set-Cookie: testcookie3=present; expires=$date; path=/");
4:    setcookie("testcookie4", "present");
5:    setcookie("testcookie5", "present", (time()+6400));
  Removed -- 6:    setcookie("testcookie6", "present", "(time()+6400)");
7:    setcookie("testcookie7", "present", (time()+6400), "/", "$HTTP_HOST");
  Removed -- 8:    setcookie("testcookie8", "present", "(time()+6400)", "/", "$HTTP_HOST");
9:    print "<meta http-equiv=\"Set-Cookie\" content=\"testcookie9=present\">\n";
10:   print "<meta http-equiv=\"Set-Cookie\" content=\"testcookie10=present; expires=$date\">\n";
11:   print "<meta http-equiv=\"Set-Cookie\" content=\"testcookie11=present; expires=$date; path=/\">\n";
12:   print "<script>document.cookie = 'testcookie12' + '=' + 'present';</script>\n";
13:   header("Set-Cookie: testcookie13=present; path=/; domain=$HTTP_HOST; expires=".gmstrftime("%A, %d-%b-%Y %H:%M:%S GMT",time()+9600));

 

posted on 2004-09-23 11:43  DiviSoft  阅读(472)  评论(0编辑  收藏  举报

导航