예제 #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        EnCryptionManager em       = new EnCryptionManager();
        string            ecurpass = em.EncryptCode(TxtOPass.Text);
        string            enewpass = em.EncryptCode(TxtNewPass.Text);
        string            cmd      = "Update Login set Pass='******'where userid='" + Session["adminid"].ToString() + "' and pass='******'";
        DBManager         dm       = new DBManager();
        bool x = dm.ExecuteMyInsertUpdateOrDelete(cmd);

        if (x == true)
        {
            Response.Write("<script>alert('Password updated Successfully.');</script>");
        }
        else
        {
            Response.Write("<script>alert('Unable To update password.your current password is invalid.');</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>");
        }
    }
예제 #3
0
    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>");
        }
    }