petertran123
04-01-2003, 07:45 PM
Hello everyone,
I'm creating a web page containing 2 links: first link i will call "Set Password Protection" and second link "View Secret Information"
Ex:
1. Set Password Protection
2. View Secret information
When user click on "Set Password Protection" they will prompt to enter password to protect for page "View Secret Information". When password has being setted, the user have to fill out password everytime they enter page "View Secret Information".
Unfortunately, If the user did not want to set password protection, then the page "View Secret Information" will not ask for password. They can view as normal
Here is my "set password protection" code please take a look and help me out
*****************begin*****************
function Modify_Password()
Dim strReturn
Dim conn, rsData, strSQL
Dim strName, strDescription
strSQL = "Select * from CHECK_PRINT_PSWD " _
& "Where OFFICE_EFIN = '" & SESSION("EFIN") & "'"
SET conn = GetDBConnection(DATABASE_CONNECT_STRING)
SET rsData = conn.Execute(strSQL)
'Do not add spaces to either of these names as they are used in the query string
'--------------------------------------------------------------------------------
If rsData.EOF then
strName = "Apply"
strDescription = "This will add password protection on the selected report."
Else
strName = "Remove"
strDescription = "This will remove the password protection on the selected report."
End If
strReturn = strReturn & vbCrlf _
& "<table border=""0"" cellspacing=""1"" cellpadding=""5"" width=""100%"">" & vbcrlf _
& " <form NAME=""FORM1"" action=""Set_Password.asp"" method=""post"">" & vbCrlf _
& " <tr>" & vbCrlf _
& " <td width=""3%"" rowspan=""4""> </td>" & vbCrlf _
& " <td colspan=""2"" class=""SubTitle"" height=""40"">" & rsData("OFFICE_EFIN") & "</td>" & vbCrlf _
& " <td colspan=""1"" class=""SubTitle"" height=""40""> Enter the password twice to confirm that your entry was made correctly. </td>" & vbCrlf _
& " <td width=""3%"" rowspan=""4""> </td>" & vbCrlf _
& " </tr>" & vbCrlf _
& " <tr>" & vbCrlf _
& " <td width=""20%"" class=""label_gray"">Enter Password:</td>" & vbCrlf _
& " <td width=""15%"" class=""field""><input type=""password"" name=""PASSWORD_1"" size=""10"" maxlength=""10""></td>" & vbCrlf _
& " <td width=""71%"" class=""standard""> </td>" & vbCrlf _
& " </tr>" & vbCrlf _
& " <tr>" & vbCrlf _
& " <td class=""label_gray"">Confirm Password:</td>" & vbCrlf _
& " <td class=""field""><input type=""password"" name=""PASSWORD_2"" size=""10"" maxlength=""10""></td>" & vbCrlf _
& " <td class=""standard""> </td>" & vbCrlf _
& " </tr>" & vbCrlf _
& " <tr>" & vbCrlf _
& " <td> </td>" & vbCrlf _
& " <td><input type=""submit"" value=""" & strName & """></td>" & vbCrlf _
& " <td class=""standard"">" & strDescription & "</td>" & vbCrlf _
& " </tr>" & vbCrlf _
& " </form>" & vbCrlf _
& "</table>"
Modify_Password = strReturn
End Function
*************end ********************
Thank you much for your help
I'm creating a web page containing 2 links: first link i will call "Set Password Protection" and second link "View Secret Information"
Ex:
1. Set Password Protection
2. View Secret information
When user click on "Set Password Protection" they will prompt to enter password to protect for page "View Secret Information". When password has being setted, the user have to fill out password everytime they enter page "View Secret Information".
Unfortunately, If the user did not want to set password protection, then the page "View Secret Information" will not ask for password. They can view as normal
Here is my "set password protection" code please take a look and help me out
*****************begin*****************
function Modify_Password()
Dim strReturn
Dim conn, rsData, strSQL
Dim strName, strDescription
strSQL = "Select * from CHECK_PRINT_PSWD " _
& "Where OFFICE_EFIN = '" & SESSION("EFIN") & "'"
SET conn = GetDBConnection(DATABASE_CONNECT_STRING)
SET rsData = conn.Execute(strSQL)
'Do not add spaces to either of these names as they are used in the query string
'--------------------------------------------------------------------------------
If rsData.EOF then
strName = "Apply"
strDescription = "This will add password protection on the selected report."
Else
strName = "Remove"
strDescription = "This will remove the password protection on the selected report."
End If
strReturn = strReturn & vbCrlf _
& "<table border=""0"" cellspacing=""1"" cellpadding=""5"" width=""100%"">" & vbcrlf _
& " <form NAME=""FORM1"" action=""Set_Password.asp"" method=""post"">" & vbCrlf _
& " <tr>" & vbCrlf _
& " <td width=""3%"" rowspan=""4""> </td>" & vbCrlf _
& " <td colspan=""2"" class=""SubTitle"" height=""40"">" & rsData("OFFICE_EFIN") & "</td>" & vbCrlf _
& " <td colspan=""1"" class=""SubTitle"" height=""40""> Enter the password twice to confirm that your entry was made correctly. </td>" & vbCrlf _
& " <td width=""3%"" rowspan=""4""> </td>" & vbCrlf _
& " </tr>" & vbCrlf _
& " <tr>" & vbCrlf _
& " <td width=""20%"" class=""label_gray"">Enter Password:</td>" & vbCrlf _
& " <td width=""15%"" class=""field""><input type=""password"" name=""PASSWORD_1"" size=""10"" maxlength=""10""></td>" & vbCrlf _
& " <td width=""71%"" class=""standard""> </td>" & vbCrlf _
& " </tr>" & vbCrlf _
& " <tr>" & vbCrlf _
& " <td class=""label_gray"">Confirm Password:</td>" & vbCrlf _
& " <td class=""field""><input type=""password"" name=""PASSWORD_2"" size=""10"" maxlength=""10""></td>" & vbCrlf _
& " <td class=""standard""> </td>" & vbCrlf _
& " </tr>" & vbCrlf _
& " <tr>" & vbCrlf _
& " <td> </td>" & vbCrlf _
& " <td><input type=""submit"" value=""" & strName & """></td>" & vbCrlf _
& " <td class=""standard"">" & strDescription & "</td>" & vbCrlf _
& " </tr>" & vbCrlf _
& " </form>" & vbCrlf _
& "</table>"
Modify_Password = strReturn
End Function
*************end ********************
Thank you much for your help