עבור לתוכן

בעיה בטופס התחברות לאתר ASP

Featured Replies

פורסם

אז ככה זה הקובץ:


<%
fn=Request.Form("fname")
id=Request.Form("id")

path=Server.mappath("users.mdb")
set con=Server.createobject("ADODB.Connection")
con.Open("provider=Microsoft.Jet.OLEDB.4.0;Data Source="& path)
con.close
set con=nothing
if R.eof=true then
response.redirect "eror.html"
else
if fn="עומר" and id="112233445" then
session("admin")="true"
session("user")="true"
response.redirect "website1.html"
else
session("user")="true"
response.redirect "website1.html"
end if

end if
R.close
set R=nothing
%>

זה לא מזהה את ה יוזר ולא את האדמין הוא ישר שולח אותי לELSE. יש עכשיו גם בעיה בקוד התחברות.

אין לי מושג איך לסדר את זה.

תודה לכל העוזרים

פורסם

<%

fn = Request.Form("fname")
id = Request.Form("id")

path = Server.mappath("users.mdb")

set con = server.CreateObject("ADODB.connection")
con.open "driver={microsoft access driver (*.mdb)}; dbq="&path

if R.eof=true AND Session("admin") <> "true" then
response.redirect "eror.html"
else
if fn = "עומר" AND id = "112233445" then
Session("admin") = "true"
Session("user") = "true"
response.Redirect "website1.html"
else
Session("user")="true"
response.Redirect "website1.html"
end if
end if

%>

נסה את זה..

פורסם

עכשיו שמתי לב שאתה בכלל לא מריץ שאילתת SQL, אני לא מבין..

למה אתה צריך חיבור למסד הנתונים אם אתה לא משתמש בו?

האופרטור <> בASP משמעותו שונה, R.eof מציין כי המסד הגיע

לסוף הטבלה המדומה (עותק של הטבלה ממסד הנתונים).

פורסם
  • מחבר

שיניתי את הקוד אבל עדיין זה לא עובד ואני לא מבין למה.



<%
fn=Request.Form("fname")
i=Request.Form("id")
sq="select*from users where
path=Server.mappath("users.mdb")
set con=Server.createobject("ADODB.connection")
Set rs = Server.CreateObject("ADODB.Recordset")
conn.open "driver={Microsoft Access Driver (*.mdb)}; DBQ=" &path
sq="select*from users where(fname='"&f&"' and i='"&i&"')
set R=con.execute(sq)
if R.eof=true then
if Request.Form("fn")="עומר" and Request.Form("id")="112233445" then
session("admin")="true"
session("user")="true"
response.redirect "website1.html"
else
session("user")="true"
response.redirect "website1.html"
end if

end if
R.close
set R=nothing
%>

פורסם

אני לא מבין מה עשית פה, יש לך מלא טעויות.

יש לך כאן משתנים שלא קיימים, יש לך שדה i בטבלה במסד או שזה אמור להיות id?

בכל מקרה:

<%
fn=Request.Form("fname")
i=Request.Form("id")

path = Server.mappath("users.mdb")

set con = server.CreateObject("ADODB.connection")
con.open "driver={microsoft access driver (*.mdb)}; dbq="&path

query = "SELECT * FROM `users` WHERE `fname`='"&fn&"' AND `id`='"&id&"'"
set R = server.CreateObject("ADODB.Recordset");

R.Open query,3,3

if R.eof then
if Request.Form("fn")="עומר" and Request.Form("id")="112233445" then
session("admin")="true"
session("user")="true"
response.redirect "website1.html"
else
session("user")="true"
response.redirect "website1.html"
end if
end if

%>

תנסה, תרשום בפעם הבאה את השגיאה שאתה מקבל.

לילה טוב.

פורסם
  • מחבר

The page cannot be displayed

There is a problem with the page you are trying to reach and it cannot be displayed.

--------------------------------------------------------------------------------

Please try the following:

Click the Refresh button, or try again later.

Open the 192.168.0.11 home page, and then look for links to the information you want.

HTTP 500.100 - Internal Server Error - ASP error

Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:

Microsoft VBScript runtime (0x800A01A8)

Object required: 'R'

/login.asp, line 11

Browser Type:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)

Page:

POST 18 bytes to /login.asp

POST Data:

fname=%F2%E5%EE%F8

Time:

‏יום שישי ‏05 ‏יוני ‏2009, 23:52:23

More information:

Microsoft Support

פורסם
[code]<%

fn=Request.Form("fname")
i=Request.Form("id")

path = Server.mappath("users.mdb")

set con = server.CreateObject("ADODB.connection")
con.open "driver={microsoft access driver (*.mdb)}; dbq="&path

query = "SELECT * FROM `users` WHERE `fname`='"&fn&"' AND `id`='"&id&"'"
set R = server.CreateObject("ADODB.Recordset")

R.Open query,3,3

if R.eof then
if Request.Form("fn")="עומר" and Request.Form("id")="112233445" then
session("admin")="true"
session("user")="true"
response.redirect "website1.html"
else
session("user")="true"
response.redirect "website1.html"
end if
end if

%>

פורסם
  • מחבר

לקחתי ממישהו קוד שעובד אבל הבעיה שהשרת לא מוצא אותו

You are not authorized to view this page

You do not have permission to view this directory or page using the credentials you supplied.

--------------------------------------------------------------------------------

Please try the following:

Click the Refresh button to try again with different credentials.

If you believe you should be able to view this directory or page, please contact the Web site administrator by using the e-mail address or phone number listed on the 192.168.0.11 home page.

HTTP 401.2 - Unauthorized: Logon failed due to server configuration

Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Background:

This is usually caused by a server-side script not sending the proper WWW-Authenticate header field. Using Active Server Pages scripting this is done by using the AddHeader method of the Response object to request that the client use a certain authentication method to access the resource.

More information:

Microsoft Support

והוא נמצא ב wwroot

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים