473,662 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with login/index scripts

index:
<%@ Page Language="VB" ContentType="te xt/html"
ResponseEncodin g="iso-8859-1" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<script runat="server">
Public strFullName As String

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s)
If Session("LoginN umber") Is Nothing Then
Response.Redire ct("login.aspx" )
Else
Dim strLoginQuery As String
strLoginQuery = "SELECT * FROM " & Session("TableT ype") & "
WHERE " & Session("PriKey ") & "='" & Session("LoginN umber")
Dim conn As OleDbConnection
Dim comm As OleDbCommand
Dim dsRead As OleDbDataReader

Dim strConn As String
strConn = "PROVIDER=Micro soft.Jet.OLEDB. 4.0;DATA SOURCE=" &
"C:\Inetpub\www root\Styles\db\ styles2k3.mdb;"
conn = New OleDbConnection (strConn)
comm = New OleDbCommand(st rLoginQuery, conn)
dsRead = comm.ExecuteRea der(CommandBeha vior.CloseConne ction)
While dsRead.Read()
If Session("TableT ype") = "FACTORIES" Then
strFullName = dsRead("FACTORY _NAME")
Else
strFullName = dsRead(Session( "Prefix") & "FNAME") &
" " & dsRead(Session( "Prefix") & "LNAME")
End If
End While
dsRead.Close()
End If
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="StyleSheet " type="text/css" href="css/styles.css" />
<title>Welcom e <%=strFullName% ></title>
</head>
<body>
</body>
</html>
login:
<%@ Page Language="VB" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>
<script runat="server">
Public strErrMessage As String

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s)
Dim strLogin As String
Dim strPass As String

strLogin = Request.Form("t xtLogin")
strPass = Request.Form("t xtPassword")
If (strLogin <"" And strPass <"") Then
Dim strTable As String
Dim strTable2 As String
Dim strPrefix As String
Dim strPrefix2 As String
Dim strPrefix3 As String

strTable = ""
strTable2 = ""
strPrefix = ""
strPrefix2 = ""
strPrefix3 = ""
Select Case Request.Form("R adioButtonList1 ").ToString ()
Case "Salesman"
strTable = "SALESLOGIN S"
strTable2 = "SALESMEN"
strPrefix = "SL_"
strPrefix2 = "S_"
strPrefix3 = "SALESMAN_"
Case "Customer"
strTable = "CUSTLOGINS "
strTable2 = "CUSTOMERS"
strPrefix = "CL_"
strPrefix2 = "C_"
strPrefix3 = "CUSTOMER_"
Case "Supplier"
strTable = "FACTORYLOG INS"
strTable2 = "FACTORIES"
strPrefix = "FL_"
strPrefix2 = "F_"
strPrefix3 = "FACTORY_"
End Select
Dim conStr As String
Dim strQueryLogins As String
strQueryLogins = "SELECT TOP 1 FROM " & strTable & " WHERE "
& strPrefix & "LOGIN='" & strLogin & "' AND " & strPrefix & "PASSWORD=' "
& strPass & "'"

conStr = "PROVIDER=Micro soft.Jet.OLEDB. 4.0;DATA SOURCE=" &
"C:\Inetpub\www root\Styles\db\ styles2k3.mdb;"
Dim conn As OleDbConnection
Dim comm As OleDbCommand
Dim objReader As OleDbDataReader

conn = New OleDbConnection (conStr)
conn.Open()
comm = New OleDbCommand(st rQueryLogins, conn)
objReader = comm.ExecuteRea der(CommandBeha vior.CloseConne ction)
If objReader.HasRo ws() Then
While objReader.Read( )
Session("LoginN umber") = objReader(strPr efix2 & "ID")
Session("PriKey ") = strPrefix3 & "ID"
Session("TableT ype") = strTable2
Session("Prefix ") = strPrefix3
End While
Response.Redire ct("index.aspx" )
Else
strErrMessage = "Error: invalid username/password, try
again"
End If
objReader.Close ()

End If
End Sub
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Login</title>
<link rel="StyleSheet " type="text/css" href="css/styles.css" />
</head>
<body>
<% If (Len(Trim(strEr rMessage)) 0) Then
Response.Write( "<font color=red>" & strErrMessage & "</font>")
End If
%>
<h3>Login to website:</h3>
<form id="frmLogin" runat="server" action="login.a spx">
<div>
<asp:Label ID="Label1" runat="server" Text="User ID:"
Width="57px"></asp:Label>
<asp:TextBox ID="txtLogin" runat="server"> </asp:TextBox><br />
<asp:Label ID="Label2" runat="server" Text="Password: "
Width="56px"></asp:Label>
<input id="txtPassword " type="password" /><br />
<br />
Are you logging in as a:<br />
<asp:RadioButto nList ID="RadioButton List1" runat="server">
<asp:ListItem Value="Customer "></asp:ListItem>
<asp:ListItem Value="Salesman "></asp:ListItem>
<asp:ListItem Value="Supplier "></asp:ListItem>
</asp:RadioButton List><br />
<asp:Button ID="btnLogin" runat="server" Text="Login" />
<asp:Button ID="btnReset" runat="server" Text="Reset"
UseSubmitBehavi or="False" /><br />

</div>
</form>
</body>
</html>

The index redirects fine on the first one, but when I login, it doesn't
seem to redirect me back to the right page (index.aspx)
Aug 24 '06 #1
0 1134

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2708
by: Rob Long | last post by:
Hey, I've written a custom HTML library using many PHP scripts as seperate files (just like I'd do a java project) and I'm having some problems where I'm including scripts in different directories from already included scripts... basically where there'a an include chain spanning multiple directories. I've reduced the problem to its core:
7
11869
by: Dan | last post by:
I was trying to troubleshoot a login page that doesn't work - it keeps saying the login/password is missing - when my tracing discovered this peculiar behavior. register_globals is off, so at the top of my script I assign a few variables to incoming GET and POST values. $login = clean($_POST, 30); $passwd = clean($_POST, 30);
3
3261
by: neilphan | last post by:
Hi Guys, Please HELP! I'm new to PHP and would like to get your professional help! I"m writing simple and small login app using php session variable. I have 3 php scripts. The first is just a simple php form, login.php, that passes the variables to auth.php.
0
2729
by: Moluske | last post by:
The web site was on another server i switch to a new one but this server hav now PHP Safe Mode to ON so i get error when creating thumbnail. I cant put PHP Safe mode to OFF. is ther any thing i can do so it will be able to create the thumbnail again ? site: www.jfl-media.com Thanks J-F her is the script:
1
4747
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...
1
1382
by: thecoolone | last post by:
I have an index.aspx page containing a button and the code in btn click is private void Button1_Click(object sender, System.EventArgs e) { if(User.Identity.IsAuthenticated) { Session=User.Identity.Name.ToString(); Server.Transfer("welcome.aspx"); } else
0
1493
by: shineyang | last post by:
Dear all: Who is kind to help me about the following problem. Why cannot log the remote node by using Net::Telent #################################### The following is normal to the process using "Telnet" #################################### $ telnet 172.30.9.2 Trying 172.30.9.2...
5
2564
by: muppetjones | last post by:
I'm really new to the whole networking side of things, so I don't know the backend very well. I wrote a series of PHP/AJAX scripts to allow a user to create a login account, but apparently my script is doing much much more than I imagined as I received an email from my admin this morning: I think a core dump means my program had a fatal error, and I know my program is supposed to email me when there is an error. Granted, I was debugging...
13
4162
by: Apostle | last post by:
Hi all, after thinking for sometimes, I thought it will be great opportunity to learn if I will start from scratch and build my own register/login system. Here is the thread that I will be posting the progress and I hope you guys will help me. The code below is what I have so far. Just put two scripts in the same directory and that is! I hope you will help me Thanks! class.php <?php //php login sytem class LoginRegister{ function...
0
8343
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,...
0
8856
Oralloy
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...
0
8762
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
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,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5653
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();...
0
4179
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...
2
1747
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.