When we visited some websites, we often encounter web pages that need to enter "User Name and Password" to verify the security of the website to ensure that the security settings of the general web page are in directory, and by setting the properties of the directory. Guarantee the security of the website, how is this web page created? The following author will introduce two ways to verify the password verification in web design, hoping to help web designers.
First, the tools provided by IIS If the designer is an administrator-level user, we can use a simple way to implement password verification. Suppose you installed the Web server is IIS, we can direct directory security settings through the Internet Service Administrator "provided by IIS. Suppose we set the / sample to a security directory, first launch the Internet Security Service Administrator, open the "default site", and we select the "home" directory. Next, select "Edit Properties". In the "Sample Properties" window that appears, select the "Directory Security Settings" option, then press the Edit button in "Anonymous Access and Verification Control", cancel the "Allow Anonymous" button, select Basic. Next, when the Internet is to browse this directory's web page, the browser will display the "Please enter the username and password" window, ask the user to enter the username and password, because the IIS verification method is combined with the NT server, as long as it is The user of the NT server is the user of IIS, so the username and password entered here are the users who have been established in the NT server and the corresponding password. Using this method we can easily implement password verification for the Sample Directory page.
Second, use the ASP program to use the program to perform password verification, which is more common, it does not have a specific request for the web server, which is designed with a database and an ASP program to implement a general web page encryption. First, we use Microsoft Access to build the "User Name and Password" data table, assume that this table is named user, the database name UserCheck.mdb, the structure of the data table is as follows: Field Description Field Name Data Type Data Length User Name ID Text 15 password PWD text 15
The source code of the verification program Pass.asp is as follows: <% Function Check (ID, PWD) DIM CONN, PAR, RS SET CONN = Server.createObject ("AdoDb.Connection") PAR = "Driver = {Microsoft Access Driver (*. MDB)} "Conn.open Par &&"; DBQ = "&& Server.mappath (" UserCheck.mdb ") SQL =" SELECT * from users where id = && id&& and pwd = && pwd && "set = conn. EXECUTE (SQL) if xi e c = false else check = true end if End function%> <% if ISempty (session ("passed") = false head = "Please enter your username and Password "ID = Request (" ID ") PWD = Request (" PWD ") if id =" "or pwd =" "" = "Please enter username and password" Else if not check (id, pwd) Then head = "User name or password is wrong" Else Session ("passed") = true end if if not session ("passed") THEN%>