From e5158343adc36c66041a524092bf039d5670a2b1 Mon Sep 17 00:00:00 2001 From: ja Date: Wed, 18 Aug 2021 16:58:48 +0200 Subject: [PATCH] =?UTF-8?q?Login=20System=20=C3=BCberarbeitet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Web.config | 2 +- login/Loggedin.aspx | 151 +++++++++++++++++++++++++++++++++++++ login/Loggedin.aspx.vb | 61 +++++++++++++++ newpageJulius_Sidebar.aspx | 17 ++++- 4 files changed, 227 insertions(+), 4 deletions(-) create mode 100644 login/Loggedin.aspx create mode 100644 login/Loggedin.aspx.vb diff --git a/Web.config b/Web.config index 8acc34d..d6fa6c1 100644 --- a/Web.config +++ b/Web.config @@ -25,7 +25,7 @@ --> - + diff --git a/login/Loggedin.aspx b/login/Loggedin.aspx new file mode 100644 index 0000000..c784403 --- /dev/null +++ b/login/Loggedin.aspx @@ -0,0 +1,151 @@ +<%@ Page Language="VB" Debug="true" AutoEventWireup="false" CodeFile="Loggedin.aspx.vb" Inherits="login_login_TEST" %> + + + + + + <%@ import Namespace="MySql.Data.MySqlClient" %> + + + VERAG Spedition AG Login + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+
+ + + + + + + + + + + + Willkommen zurück: + + + + + + + + + + + + + + + +
Erfolgreich eingeloggt!
+ + +
+ Benutzername: + + + * +
+ Kennwort: + + + * +
+
+
+
+
+
+
+ + + diff --git a/login/Loggedin.aspx.vb b/login/Loggedin.aspx.vb new file mode 100644 index 0000000..8791881 --- /dev/null +++ b/login/Loggedin.aspx.vb @@ -0,0 +1,61 @@ +Imports System.Data.SqlClient +Imports System.Data + +Partial Class login_login_TEST + Inherits System.Web.UI.Page + + Protected Sub ValidateUser(sender As Object, e As EventArgs) + Dim userId As Integer = 0 + ' cDBFunctions.GetNewOpenConnection() + Dim ConnectionString = "" + If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then + 'ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956" + ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;" + Else + ConnectionString = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;" + 'ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;" + End If + + + ' Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString + Using con As New SqlConnection(ConnectionString) + ' Using cmd As New SqlCommand("Validate_User") + Using cmd As New SqlCommand("SELECT COUNT(*) FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username AND Password=@Password") + ' cmd.CommandType = CommandType.StoredProcedure + cmd.Parameters.AddWithValue("@Username", Login1.UserName) + cmd.Parameters.AddWithValue("@Password", Login1.Password) + cmd.Connection = con + con.Open() + ' userId = Convert.ToInt32(cmd.ExecuteScalar()) + Dim dr As SqlDataReader = cmd.ExecuteReader() + If dr.HasRows Then + dr.Read() + 'MsgBox(dr.Item(0).ToString()) + Select Case dr.Item(0) + Case 0 + Login1.FailureText = "Username and/or password is incorrect." + Exit Select + Case -2 + Login1.FailureText = "Account has not been activated." + Exit Select + Case Else + FormsAuthentication.RedirectFromLoginPage(Login1.UserName, Login1.RememberMeSet) + 'FormsAuthentication.SetAuthCookie(Login1.UserName, True) + 'Response.Redirect("mypage.aspx") + Exit Select + End Select + End If + dr.Close() + con.Close() + End Using + + + End Using + End Sub + + + + Protected Sub LoginButton_Click(sender As Object, e As EventArgs) + + End Sub +End Class diff --git a/newpageJulius_Sidebar.aspx b/newpageJulius_Sidebar.aspx index ab47ba9..f08351f 100644 --- a/newpageJulius_Sidebar.aspx +++ b/newpageJulius_Sidebar.aspx @@ -1,4 +1,4 @@ -<%@ Page Language="VB" Debug="true" AutoEventWireup="false" CodeFile="newpageJulius_Sidebar.aspx.vb" Inherits="_Default" %> +<%@ Page Language="VB" Debug="true" AutoEventWireup="false" CodeFile="newpageJulius_Sidebar.aspx.vb" Inherits="_Default" %> @@ -935,6 +935,7 @@