nth 1
New Member
I wan to filter the database show out information by using the user login name. Means that when that user login by entering their names n password, if correct then it will go to the other page by showing that user result only, not other user result. Can somebody help me pls?.
Following is the login page code: -
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
-
<!--#include file="Connections/conResult.asp" -->
-
<%
-
Dim Recordset1__MMColParam
-
Recordset1__MMColParam = "1"
-
If (Session("username") <> "") Then
-
Recordset1__MMColParam = Session("username")
-
End If
-
%>
-
<%
-
Dim Recordset1
-
Dim Recordset1_numRows
-
-
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
-
Recordset1.ActiveConnection = MM_conResult_STRING
-
Recordset1.Source = "SELECT * FROM Student WHERE Name = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
-
Recordset1.CursorType = 0
-
Recordset1.CursorLocation = 2
-
Recordset1.LockType = 1
-
Recordset1.Open()
-
-
Recordset1_numRows = 0
-
%>
-
<%
-
' *** Validate request to log in to this site.
-
MM_LoginAction = Request.ServerVariables("URL")
-
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
-
MM_valUsername=CStr(Request.Form("textfield"))
-
If MM_valUsername <> "" Then
-
MM_fldUserAuthorization=""
-
MM_redirectLoginSuccess="Result.asp"
-
MM_redirectLoginFailed="Login4.asp"
-
MM_flag="ADODB.Recordset"
-
set MM_rsUser = Server.CreateObject(MM_flag)
-
MM_rsUser.ActiveConnection = MM_conResult_STRING
-
MM_rsUser.Source = "SELECT Name, ID"
-
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
-
MM_rsUser.Source = MM_rsUser.Source & " FROM Student WHERE Name='" & Replace(MM_valUsername,"'","''") &"' AND ID='" & Replace(Request.Form("textfield2"),"'","''") & "'"
-
MM_rsUser.CursorType = 0
-
MM_rsUser.CursorLocation = 2
-
MM_rsUser.LockType = 3
-
MM_rsUser.Open
-
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
-
' username and password match - this is a valid user
-
Session("MM_Username") = MM_valUsername
-
If (MM_fldUserAuthorization <> "") Then
-
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
-
Else
-
Session("MM_UserAuthorization") = ""
-
End If
-
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
-
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
-
End If
-
MM_rsUser.Close
-
Response.Redirect(MM_redirectLoginSuccess)
-
End If
-
MM_rsUser.Close
-
Response.Redirect(MM_redirectLoginFailed)
-
End If
-
%>
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
-
<title>Untitled Document</title>
-
</head>
-
-
<body>
-
<table width="344" border="1" align="center">
-
<tr>
-
<td width="334" height="220"><div align="center">
-
<form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
-
<p>Username:
-
<input type="text" name="textfield" />
-
</p>
-
<p>Password:
-
<input type="password" name="textfield2" />
-
</p>
-
<p>
-
<input type="submit" name="Submit" value="Enter" />
-
</p>
-
</form>
-
</div></td>
-
</tr>
-
</table>
-
</body>
-
</html>
-
<%
-
Recordset1.Close()
-
Set Recordset1 = Nothing
-
%>
Following is the result page code: -
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
-
<!--#include file="Connections/conResult.asp" -->
-
<%
-
Dim Recordset1__MMColParam
-
Recordset1__MMColParam = "1"
-
If (Session("username") <> "") Then
-
Recordset1__MMColParam = Session("username")
-
End If
-
%>
-
<%
-
Dim Recordset1
-
Dim Recordset1_numRows
-
-
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
-
Recordset1.ActiveConnection = MM_conResult_STRING
-
Recordset1.Source = "SELECT * FROM CourseCode WHERE StudentName = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
-
Recordset1.CursorType = 0
-
Recordset1.CursorLocation = 2
-
Recordset1.LockType = 1
-
Recordset1.Open()
-
-
Recordset1_numRows = 0
-
%>
-
<%
-
Dim Repeat1__numRows
-
Dim Repeat1__index
-
-
Repeat1__numRows = 10
-
Repeat1__index = 0
-
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
-
%>
-
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
-
<title>Untitled Document</title>
-
</head>
-
-
<body>
-
<table border="1" cellpadding="2" cellspacing="1">
-
<tr>
-
<td>StudentName</td>
-
<td>StudentID</td>
-
<td>Programme</td>
-
<td>CourseCode</td>
-
<td>Grade</td>
-
<td>Semester</td>
-
</tr>
-
<% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) %>
-
<tr>
-
<td><%=(Recordset1.Fields.Item("StudentName").Value)%></td>
-
<td><%=(Recordset1.Fields.Item("StudentID").Value)%></td>
-
<td><%=(Recordset1.Fields.Item("Programme").Value)%></td>
-
<td><%=(Recordset1.Fields.Item("CourseCode").Value)%></td>
-
<td><%=(Recordset1.Fields.Item("Grade").Value)%></td>
-
<td><%=(Recordset1.Fields.Item("Semester").Value)%></td>
-
</tr>
-
<%
-
Repeat1__index=Repeat1__index+1
-
Repeat1__numRows=Repeat1__numRows-1
-
Recordset1.MoveNext()
-
Wend
-
%>
-
</table>
-
</body>
-
</html>
-
<%
-
Recordset1.Close()
-
Set Recordset1 = Nothing
-
%>
1 2028 jhardman 3,406
Recognized Expert Specialist
nth,
Welcome to theScripts.com, we're glad you found it. Just a couple things you should know:
1- please enclose your code in code tags (if you hit "reply" on your original post you will see the codes I used, or you can use the provided # button). this makes it much easier to read.
2- There is no size limit, so no reason to use SMS speak. Please write out your words ("and" not "n" etc)
That said, please clarify your problem. What part is giving you trouble?
Jared
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Matt |
last post by:
Hi everyone, still pretty new to MySQL. I was
wondering if there is a way to automatically filter
records based on a mysql userlogin name??
I have serveral databases that I want to combine
in order to manage the databases more efficiently.
- I'm currently using MySQL 4.1.12 and I'm currently testing 5.0.14
- I have a databases for each user account.
- Each database has the same schema and entity relation model.
|
by: Hemant Shah |
last post by:
Folks,
We have an SQL statement that was coded in an application many years ago
(starting with DB V2 I think). When I upgraded to UDB 8.2, the optimizer
does not use optimal path to access the data.
It takes about 4 minutes to get the data. In previous versions it was
instantaneous.
What do I need to do to increase the performance?
|
by: CSDunn |
last post by:
Hello,
I have a problem with field filtering between an Access 2000 Project form
(the application is called CELDT), and the report that shows the results of
the filter. Both the form and the report are based on the same View
addressed in the Record Source of both as 'dbo.CLMain_vw'. The View resides
in a SQL Server 2000 database. There are two different problems I am having
with filtering: The first involves filtering in the form by date...
|
by: michael haller |
last post by:
In my project i have a textfile witch i import in my c# application.
The datas in the textfile i show the datas in the textfile in my
datagrid..ok that ist not my problem.
Now i have a dataset (dataset.xsd the name is ds_BESR).
How i can my datas in the datagrid into this dataset ds_BESR?
Please help me...i need that. the reasen is my crystal report get the datas
|
by: ElmoWatson |
last post by:
I tried on the Security newgroup, as well as other places, and haven't
gotten an answer yet - - I'm pulling my hair out over this one.
I'm trying to get Forms Authentication working.....I can get any requested
page to automatically go to the Login.aspx page, AND, the ReturnURL
querystring is correct in the address bar, but no matter what, I can't get
it, once the user is authenticated, to redirect to the new page. It ALWAYS
refreshes the...
| |
by: Andrew |
last post by:
Hey all,
Working on revamping our Intranet here and making use of the LDPA, Active
Directory, Directory Services, etc. that .Net provides. I am still fairly
new on this subject, so the problem I have run into I am not sure how to
fix, and really not sure what is causing it.
Here's what is going on (test server - Windows 2003 Server):
I have a page in a folder (under anonymous authentication in IIS6) that has
a link on it that...
|
by: doctorfeelyg |
last post by:
Hi there,
I’m relatively new to access so please forgive any ignorance. Here is my, rather long-winded, plea for help:
I have a main table which contains a list of ‘projects’ and associated information (team name, staff member dealing with a particular project, project description, budget etc). Team names and staff names are stored in separate tables and linked to the main table by their ID.
I have fed the various required fields into...
|
by: osward |
last post by:
Hello there,
I am using phpnuke 8.0 to build my website, knowing little on php programing.
I am assembling a module for my member which is basically cut and paste existing code section of various module that I found it useful.
Here is the 1st problem I encounter:
I had a function to edit a event row form the database which is fine with me, than I pass on the code to a function that save(update) the data to the database.
|
by: VictorG |
last post by:
Hello,
I am trying to secure a webservice using WSE 3.0 and the turnkey
usernameForCertificateSecurity profile. I am passing a valid username
token, and on the server I have overridden the Authenticate token
call
and it is being called. My ASP.NET service has a Login() method and
it is being called during client application startup. Both the client
and service have matching policy config files. Once authentication
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |