Beispiel #1
0
    protected void btnlogin_Click(object sender, ImageClickEventArgs e)
    {
        DBManager         dm    = new DBManager();
        EnCryptionManager em    = new EnCryptionManager();
        string            epass = em.encryptmydata(txtpass.Text);
        string            cmd   = "Select *from Login where userid='" + txtUID.Text + "' and pass='******' and status=true";
        DataTable         dt    = dm.ExecuteMySelect(cmd);

        if (dt.Rows.Count > 0)
        {
            cmd = "update Login set Lcount=(Lcount+1),LoginTime='" + DateTime.Now.ToString() + "' where userid='" + txtUID.Text + "' and pass='******'";
            bool x = dm.ExecuteMyINsertUpdateOrDelete(cmd);
            if (x == true)
            {
                Session["userid"] = txtUID.Text;
                Response.Redirect("~/Consumer Zone/Home.aspx");
            }
            else
            {
                Response.Write("<script>alert('Unable to login!');</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('Invalid UserID or Password.');</script>");
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string gender = "";

        if (rdbmale.Checked == true)
        {
            gender = "male";
        }
        else
        {
            gender = "female";
        }
        if (txtcaptcha.Text == ccode)
        {
            DBManager dm   = new DBManager();
            string    code = "select * from Login where UserID='" + txtEmail.Text + "' ";
            DataTable dt   = dm.ExecuteMySelect(code);
            if (dt.Rows.Count > 0)
            {
                Response.Write("<script>alert('Email ID already REGISTERED!');</script>");
                txtEmail.Text = "";
            }
            else
            {
                string            epass;
                EnCryptionManager em = new EnCryptionManager();
                epass = em.encryptmydata(txtpass.Text);
                string mycommand = "Insert into Registration(ConType,UName,Gender,MobileNo,EmailId,Address,ProfilePic,Pass,RegDT,secquestion,secanswer) values('" + ddlcontype.SelectedValue + "','" + txtname.Text + "','" + gender + "','" + txtMoNo.Text + "','" + txtEmail.Text + "','" + txtaddress.Text + "','" + FuPicture.FileName + "','" + epass + "','" + DateTime.Now.ToString() + "','" + ddlsecurequest.SelectedValue + "','" + txtAnswer.Text + "')";

                bool b = dm.ExecuteMyINsertUpdateOrDelete(mycommand);
                if (b == true)
                {
                    mycommand = "Insert into Login values('" + txtEmail.Text + "','" + epass + "',1,0,'')";
                    b         = dm.ExecuteMyINsertUpdateOrDelete(mycommand);
                    if (b == true)
                    {
                        FuPicture.SaveAs(Server.MapPath("~/UserPics/" + FuPicture.FileName));
                        string    cmd = "select CustomerId from Registration where EmailId='" + txtEmail.Text + "'";
                        DataTable d   = dm.ExecuteMySelect(cmd);
                        string    s   = d.Rows[0][0].ToString();
                        msgbox("You are registered successfully. Your Customer Id is:  " + s + "                    Please note it successfully.");
                        txtaddress.Text = "";
                        txtAnswer.Text  = "";
                        txtcaptcha.Text = "";
                        txtconpass.Text = "";
                        txtEmail.Text   = "";
                        txtMoNo.Text    = "";
                        txtname.Text    = "";
                        txtpass.Text    = "";
                    }
                    else
                    {
                        Response.Write("<script>alert('Your registration failed.')</script>");
                    }
                }
            }
        }
    }
    protected void BtnChange_Click(object sender, EventArgs e)
    {
        EnCryptionManager em       = new EnCryptionManager();
        string            ecurpass = em.encryptmydata(TxtCurPass.Text);
        string            enewpass = em.encryptmydata(TxtNewPass.Text);
        string            cmd      = "Update Login set Pass='******' where userid='" + Session["Userid"].ToString() + "' and pass='******'";
        DBManager         dm       = new DBManager();
        bool x = dm.ExecuteMyINsertUpdateOrDelete(cmd);

        if (x == true)
        {
            Response.Write("<script>alert('Password updated successfiully.');</script>");
        }
        else
        {
            Response.Write("<script>alert('Unable to update password. your current password in invalid.');</script>");
        }
    }
    protected void BtnChange_Click(object sender, EventArgs e)
    {
        DBManager         dm      = new DBManager();
        EnCryptionManager em      = new EnCryptionManager();
        string            OldPass = em.encryptmydata(TxtOldPass.Text);
        string            newpass = em.encryptmydata(TxtNewPass.Text);
        string            cm      = "Update Login set Pass='******' where pass='******' and userid='" + Session["adminid"] + "'";
        bool b = dm.ExecuteMyINsertUpdateOrDelete(cm);

        if (b == true)
        {
            Response.Write("<script>alert('Password updated successfiully.');</script>");
        }
        else
        {
            Response.Write("<script>alert(' password not updated.');</script>");
        }
    }
    protected void BtnRegister_Click(object sender, EventArgs e)
    {
        string gender = "";

        if (RdBMale.Checked == true)
        {
            gender = "Male";
        }
        else
        {
            gender = "Female";
        }
        if (TxtCaptcha.Text == ccode)
        {
            string            epass;
            EnCryptionManager em = new EnCryptionManager();
            epass = em.EncryptCode(TxtPass.Text);
            string    MyCommand = "Insert into Registration values('" + TxtName.Text + "','" + TxtFName.Text + "','" + gender + "','" + TxtMobNo.Text + "','" + DDLQualification.SelectedValue + "','" + DDLSelectGroup.SelectedValue + "','" + TxtAddress.Text + "','" + TxtEmail.Text + "','" + FUPic.FileName + "','" + epass + "','" + DateTime.Now.ToString() + "')";
            DBManager dm        = new DBManager();
            bool      b         = dm.ExecuteMyInsertUpdateOrDelete(MyCommand);
            if (b == true)
            {
                MyCommand = "Insert into Login Values('" + TxtEmail.Text + "','" + epass + "',1,0,'')";
                b         = dm.ExecuteMyInsertUpdateOrDelete(MyCommand);
                if (b == true)
                {
                    FUPic.SaveAs(Server.MapPath("~/UserPics/" + FUPic.FileName));
                    Response.Write("<script>alert('You are Registered Successfully.');</script>");
                }
                else
                {
                    Response.Write("<script>alert('Unable to set login details.');</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Sorry! Unable to Register.');</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('Invalid Captcha Code');</script>");
        }
    }
    protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
    {
        DBManager         dm    = new DBManager();
        EnCryptionManager em    = new EnCryptionManager();
        String            epass = em.EncryptCode(Txtpassword.Text);
        string            cmd   = "select *from Login where userid='" + TxtAdminid.Text + "' and pass='******' and status=true";
        DataTable         dt    = dm.ExecuteMySelect(cmd);

        if (dt.Rows.Count > 0)
        {
            cmd = "Update Login set Lcount=(Lcount+1),LoginTime='" + DateTime.Now.ToString() + "' where userid='" + TxtAdminid.Text + "' and pass='******'";
            bool x = dm.ExecuteMyInsertUpdateOrDelete(cmd);
            Session["adminid"] = TxtAdminid.Text;
            Response.Redirect("~/Admin/AdminHome.aspx");
        }
        else
        {
            Response.Write("<script>alert('Invalid userid or password.');</script>");
        }
    }
Beispiel #7
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DBManager         dm   = new DBManager();
        EnCryptionManager em   = new EnCryptionManager();
        string            code = "select * from Registration where EmailId='" + txtEmail.Text + "' and MobileNo='" + txtphone.Text + "' and secquestion='" + ddlquestion.SelectedValue + "' and secanswer='" + txtsecans.Text + "'";
        DataTable         dt   = dm.ExecuteMySelect(code);

        if (dt.Rows.Count > 0)
        {
            string    cmd = "select Pass from Login where userid='" + txtEmail.Text + "'";
            DataTable d   = dm.ExecuteMySelect(cmd);
            string    s   = em.decryptmydata(d.Rows[0][0].ToString());
            txtEmail.Text             = "";
            txtsecans.Text            = "";
            txtphone.Text             = "";
            ddlquestion.SelectedIndex = 0;
            msgbox("Your Password is:  " + s);
        }
        else
        {
            Response.Write("<script>alert('Sorry! Record not found.');</script>");
        }
    }