Learning purpose: basic SESSION components, summary of response and request components.
First of all, any program with a membership system will use the step of detecting whether the user has logged in. This uses the SESSION component. Let's look at a code to illustrate.
<%
session("islogin")="yes"
%>
What this sentence means is to define an islogin string variable in the session with the value "yes", which can be assigned directly without declaration. Isn't it very simple?
If we log in to the system as an administrator, the first step is to check whether we are an administrator.
if is then
session("isadmin")=yes"
else
session("isadmin")="no"
end if
Add at the beginning of every page that requires administrators to see
<%
if not session("isaadmin")="yes"then
response.redirect "login.htm"
%>
In this way, ordinary users cannot open this page. Explain response.redirect, it means redirection, and the "login.htm" behind it is the redirection file. In this way, administrators who are not logged in cannot see the subsequent content.
To summarize, the response component basically uses response.write () and response.redirect(), which are used to write strings and redirect respectively. The request is basically request.form() and request.querystring(), which accept post and get methods respectively. That’s all for today’s information. My final demonstration is a login system that you can study. Basically, the above knowledge points are relatively simple.