There is 3 pages
Page 1: (login.asp)
<!--#INCLUDE file="dbase.asp"-->
<%lg = request("lg"
%>
<html>
<head>
<title>Login</title>
<script>
</script>
</head>
<body>
<center>
<img src="baktop1.jpg" border="0">
<form method="post" name="f1" action="login2.asp">
<table cellpadding=5 cellspacing=0 border=0>
<tr>
<td> Användarnamn:</font></td>
<td><input type="text" size="15" name="username" maxlength="10" style="font-size:13px;font-face:arial;width:100px"> </td>
</tr>
<tr>
<td> Lösenord:</font></td>
<td><input type="password" size="15" name="password" maxlength="10" style="font-size:13px;font-face:arial;width:100px"> </td>
</tr>
<tr>
<td></td>
<td><input type="Submit" value="Login" name="submit" style="font-size:13px;font-face:arial;width:80px"></td>
</tr>
</table>
</form>
<%if lg="nousername" then%>
<font color=red>Bad username</font>
<%elseif lg="nopassword" then%>
<font color=red>Bad password</font>
<%end if%>
</center>
</body>
</html>
Page2: (login2.asp)
<% Option Explicit %>
<!--#INCLUDE file="dbase.asp"-->
<%
dim conn, rs, sql
Set conn = Server.CreateObject("ADODB.Connection"
Set rs = Server.CreateObject("ADODB.Recordset"
sql = "SELECT * FROM lev WHERE AfUsername ='" & request("username"
& "'"
Conn.Open dsn
rs.open sql, conn
If NOT rs.EOF Then
If request("password"
= rs("password"
Then
session("AfLogin"
= "true"
Session("AfUsername"
= request("username"
if Session("AfUsername"
= "admin" then
Response.Redirect "admin.asp"
else
Response.Redirect "lager.asp"
end if
else
Session("AfLogin"
= "false"
Response.Redirect "login.asp?lg=nopassword"
End If
Else
Session("AfLogin"
= "false"
response.redirect "login.asp?lg=nousername"
End If%>
Page 3 : lager.asp
This page displays the results of what user that logins
sql = "SELECT * FROM PULAGER Where not D1132='0' AND D18020 LIKE '%" & Request.Form("Username"
& "%' "
but it doesnt work. it shows all posts in the table instead of only the posts where the username match with the posts...
What is wrong???
Page 1: (login.asp)
<!--#INCLUDE file="dbase.asp"-->
<%lg = request("lg"
<html>
<head>
<title>Login</title>
<script>
</script>
</head>
<body>
<center>
<img src="baktop1.jpg" border="0">
<form method="post" name="f1" action="login2.asp">
<table cellpadding=5 cellspacing=0 border=0>
<tr>
<td> Användarnamn:</font></td>
<td><input type="text" size="15" name="username" maxlength="10" style="font-size:13px;font-face:arial;width:100px"> </td>
</tr>
<tr>
<td> Lösenord:</font></td>
<td><input type="password" size="15" name="password" maxlength="10" style="font-size:13px;font-face:arial;width:100px"> </td>
</tr>
<tr>
<td></td>
<td><input type="Submit" value="Login" name="submit" style="font-size:13px;font-face:arial;width:80px"></td>
</tr>
</table>
</form>
<%if lg="nousername" then%>
<font color=red>Bad username</font>
<%elseif lg="nopassword" then%>
<font color=red>Bad password</font>
<%end if%>
</center>
</body>
</html>
Page2: (login2.asp)
<% Option Explicit %>
<!--#INCLUDE file="dbase.asp"-->
<%
dim conn, rs, sql
Set conn = Server.CreateObject("ADODB.Connection"
Set rs = Server.CreateObject("ADODB.Recordset"
sql = "SELECT * FROM lev WHERE AfUsername ='" & request("username"
Conn.Open dsn
rs.open sql, conn
If NOT rs.EOF Then
If request("password"
session("AfLogin"
Session("AfUsername"
if Session("AfUsername"
Response.Redirect "admin.asp"
else
Response.Redirect "lager.asp"
end if
else
Session("AfLogin"
Response.Redirect "login.asp?lg=nopassword"
End If
Else
Session("AfLogin"
response.redirect "login.asp?lg=nousername"
End If%>
Page 3 : lager.asp
This page displays the results of what user that logins
sql = "SELECT * FROM PULAGER Where not D1132='0' AND D18020 LIKE '%" & Request.Form("Username"
but it doesnt work. it shows all posts in the table instead of only the posts where the username match with the posts...
What is wrong???