Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Web;
- using System.Web.Configuration;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace MyProject
- {
- public partial class BootstrapTutorial : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- //Logga in
- DBconnection newConnection = new DBconnection();
- newConnection.MyConnection();
- string checkUser = "SELECT count(*) FROM Kund WHERE Anvandarnamn='" + txtAnvandarnamn.Text + "'";
- SqlCommand cmd = new SqlCommand(checkUser, DBconnection.conn);
- int temp = Convert.ToInt32(cmd.ExecuteScalar().ToString());
- DBconnection.conn.Close();
- if(temp == 1)
- {
- DBconnection.conn.Open();
- string checkPassword = "SELECT Losenord FROM Kund WHERE Anvandarnamn='" + txtAnvandarnamn.Text + "'";
- SqlCommand passCmd = new SqlCommand(checkPassword, DBconnection.conn);
- string password = passCmd.ExecuteScalar().ToString();
- if(password == txtLosenord.Text)
- {
- Session["Anvandarnamn"] = txtAnvandarnamn.Text;
- Response.Redirect("Webshop.aspx");
- }
- else
- {
- Response.Write("Lösenordet är inte korrekt!");
- }
- }
- else
- {
- Response.Write("Användarnamn är inte korrent!");
- }
- }
- protected void Login_Click(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement