Example cookies rsp

From Lianjapedia
(Redirected from Cookies rsp)
Jump to: navigation, search

Name

example_cookies.rsp

Description

This Visual FoxPro Server Page (.rsp) demonstrates querying of the _SERVER[], _SESSION[] and _COOKIE global associative arrays.

Code

<%@ Language=VFP %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Lianja example - accessing cookies</title>
</head>
<body>
<%
  // Get the hostname for the remote machine requesting the page
  ? "_server[ ] elements"
  foreach _server as name=>value 
    ? "<br>   &name="+etos(value)
  next
  ? "<br><br>"
  ? date()
  ? time()
  ? "<br><br>"
 
  cc=len(_COOKIE)
  if cc > 0
	? "Active session Cookies ("+alltrim(str(cc))+")"
	foreach _cookie as name=>value 
		? "<br>   &name="+etos(value)
	endfor
  else
	? "There are no active session cookies."
  endif
  ? "<br><br>"
 
  ss=len(_SESSION)
  if ss > 0
	? "Active session variables ("+alltrim(str(ss))+")"
	foreach _session as name=>value 
		? "<br>   &name="+etos(value)
	next
  else
	? "There are no active session variables."
  endif
 
  ? "<br><br>Press the browser refresh key."
  _session["time"] = time()
%>
</body>
</html>