Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data.SqlClient;
- using System.Configuration;
- public partial class Login : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void btnLogin_Click(object sender, EventArgs e)
- {
- SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["KwSConnectionString"].ConnectionString);
- con.Open();
- string cmdStr= "Select count (*) from tblRegistration where username '" + txtPlayertag + '"';
- SqlCommand checkUser = new SqlCommand(cmdStr, con);
- int temp = Convert.ToInt32(checkUser.ExecuteScalar().ToString());
- if (temp == 1)
- {
- string cmdStr2 = "Select Password from tblRegistration where playertag '" + txtPlayertag + '"';
- SqlCommand pass = new SqlCommand(cmdStr2, con);
- string password = pass.ExecuteScalar().ToString();
- if (password == txtPassword.Text)
- {
- Session["New"] = btnLogin;
- Response.Redirect("Secure.aspx");
- }
- else
- {
- Label1.Visible = true;
- Label1.Text = "Invalid Password!";
- }
- }
- else
- {
- Label1.Visible = true;
- Label1.Text = "Invalid Playertag!";
- }
- con.Close();
- }
- }
Add Comment
Please, Sign In to add comment