this is a script i would like to use for a website. from my understanbding this is a connectionless file. can somebody try to help me how i would change this script in a form that i can use the dns "login" with it?
<%@ Language=VBScript %>
<%
Dim sSQL,conn,rs
Set conn = Server.CreateObject("ADODB.Connection")
set rs = server.CreateObject("ADODB.Recordset")
'DSN less connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.ConnectionString = "Data Source=" & Server.MapPath("fpdb/login.mdb")
conn.open
strsql = "Select firstname,lastname from Results"
set rs = conn.Execute (strsql)
if (rs.BOF)and (rs.EOF) then
sSQL = "Insert into Results (firstname,lastname,User_name,pw) Values" & _
"('"& Ucase(Request("firstname")) & "', '"& Request("lastname") & "', '"& _
Request("userid") & "', '" & Request("pw") & "')"
conn.Execute sSQL,adCmdText
else
SQL = "Delete * from Results where User_name= '" & Request.Form("userid") & "'"
conn.execute(SQL)
end if
sSQL = "Insert into Results (firstname,lastname,User_name,pw) Values" & _
"('"& Ucase(Request("firstname")) & "', '"& Request("lastname") & "', '"& _
Request("userid") & "', '" & Request("pw") & "')"
conn.Execute sSQL,adCmdText
'close the recordset
rs.close
set rs = nothing
'close the connection
conn.close
set conn = nothing
%>
Your login details have been saved to the database
Thank you in advance
Best,
Andrea
Comments
I would like to protect the index page so that you can only see it after logging into the site. therefore i created a "Check.asp" file which i include into the index page
Check.asp
<%if Request.Cookies("User_name") <> "" then
Response.Redirect ("send them to view the web site")
session("submitted")="false"
else
'send them back to login page
Response.Redirect "login.htm"
Response.End
end if%>
index.htm
<--#include file="Check.asp"-->
...
right now i always see whatever i have in the index page and i will never be redirected to the login page. Does anybody have suggestions for me?
Thank you in advance
Best,
Andrea
deleting it, closing all browser windows, then revisit
the index page and see if you are redirected.
Rod
reason1000
: I got this part of my script to work. now i have one tiny little question and than i can use this script.
:
: I would like to protect the index page so that you can only see it after logging into the site. therefore i created a "Check.asp" file which i include into the index page
:
: Check.asp
:
: <%if Request.Cookies("User_name") <> "" then
: Response.Redirect ("send them to view the web site")
: session("submitted")="false"
: else
: 'send them back to login page
: Response.Redirect "login.htm"
: Response.End
: end if%>
:
: index.htm
:
: <--#include file="Check.asp"-->
:
:
: ...
:
:
: right now i always see whatever i have in the index page and i will never be redirected to the login page. Does anybody have suggestions for me?
:
: Thank you in advance
:
: Best,
:
: Andrea
:
is there something i can do with the following script to make the script work without a loop?
<%@ Language=VBScript %>
<%Response.Buffer=true%>
<%
Dim conn,rs,strsql
set conn = server.CreateObject("ADODB.Connection")
set rs = server.CreateObject("ADODB.Recordset")
'DSN less connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.ConnectionString = "Data Source=" & Server.MapPath("/fpdb/login.mdb")
conn.open
strsql = "Select User_name, pw From Results where User_name = '" & _
Request.Form("txtusername") & "' and pw = '" & _
Request.Form("txtpassword") & "'"
set rs = conn.Execute (strsql)
If (not rs.BOF) and (not rs.EOF) then
Response.Cookies("User_name") = rs.Fields("User_name")
Response.Redirect "http://209.133.225.148/index.asp"
else
Response.Redirect "http://209.133.225.148/wrong.htm"
end if
'close the recordset
rs.close
set rs = nothing
'close the connection
conn.close
set conn = nothing
%>
Thank you in advance
andrea