Beispiel #1
0
    protected void btnchange_Click(object sender, EventArgs e)
    {
        CryptoGraphy cg        = new CryptoGraphy();
        string       oldpass   = OldPass.Text;
        string       newpass   = NewPass.Text;
        string       renewpass = ReNewPass.Text;

        oldpass   = cg.MD5Hash(oldpass);
        newpass   = cg.MD5Hash(newpass);
        renewpass = cg.MD5Hash(renewpass);

        string          email = Session["PatientEmail"].ToString();
        DataBaseManager dbm   = new DataBaseManager();
        string          sql1  = "select * from RegistrationTbl where Email='" + email + "'";
        DataTable       dt    = new DataTable();

        dt = dbm.ExecuteSelect(sql1);
        if (dt.Rows.Count > 0)
        {
            if (dt.Rows[0]["Password"].ToString() == oldpass)
            {
                if (newpass == renewpass)
                {
                    string sql2 = "update RegistrationTbl set Password='******' where Email='" + email + "'";
                    if (dbm.ExecuteIUD(sql2))
                    {
                        Response.Write("<script>alert('Password Changed Successfully.')</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('Something went wrong.')</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('New Password Not Matched.')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Old Password Not Matched.')</script>");
            }
        }
        else
        {
            Response.Redirect("../Login.aspx");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string       name     = TextBox1.Text;
        string       age      = TextBox2.Text;
        string       mobile   = TextBox3.Text;
        string       gender   = RadioButtonList1.SelectedItem.Text;
        string       email    = TextBox4.Text;
        string       password = TextBox5.Text;
        CryptoGraphy cg       = new CryptoGraphy();

        password = cg.MD5Hash(password);
        string specialmedical = TextBox6.Text;

        Random rnd = new Random();

        string otp       = rnd.Next(100000, 999999).ToString();
        bool   otpstatus = false;

        string date = DateTime.Now.ToString("MM/dd/yyyy");
        string time = DateTime.Now.ToString("HH:mm:ss");

        DataBaseManager dbm = new DataBaseManager();

        string    checkemail = "select * from RegistrationTbl where Email='" + email + "'";
        DataTable dt         = new DataTable();

        dt = dbm.ExecuteSelect(checkemail);
        if (dt.Rows.Count > 0)
        {
            Response.Write("<script>alert('Email ID is already registered. Please use another Email ID')</script>");
        }
        else
        {
            string query = "insert into RegistrationTbl(Name,Age,Mobile,Gender,Email,Password,SpecialMedicalCondition,OTP,OTPStatus,Date,Time) values('" + name + "','" + age + "','" + mobile + "','" + gender + "','" + email + "','" + password + "','" + specialmedical + "','" + otp + "','" + otpstatus + "','" + date + "','" + time + "')";
            if (dbm.ExecuteIUD(query))
            {
                // send OTP and Redirect to OTP Verification page

                SMSSender sms     = new SMSSender();
                string    message = "Dear " + name + ", Your OTP Verification Code is - " + otp;
                bool      smsst   = sms.SendSMS(mobile, message);

                // Create Session for OTP Verification

                Session["RegEmail"] = email;

                Response.Write("<script>alert('Data Saved. We have sent you OTP Code, Please enter to proceed.'); window.location.href='OTPVerification.aspx';</script>");
            }
            else
            {
                // Query Error
                Response.Write("<script>alert('Something went wrong, please try again leter, some technical issue.')</script>");
            }
        }
    }
Beispiel #3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataBaseManager dbm      = new DataBaseManager();
        string          email    = TextBox1.Text;
        string          password = TextBox2.Text;
        string          sql      = "select * from RegistrationTbl where Email='" + email + "'";
        DataTable       dt       = new DataTable();

        dt = dbm.ExecuteSelect(sql);
        if (dt.Rows.Count > 0)
        {
            bool otpst = Convert.ToBoolean(dt.Rows[0]["OTPStatus"]);
            if (otpst)
            {
                CryptoGraphy cg = new CryptoGraphy();
                password = cg.MD5Hash(password);
                string    sql1 = "select * from RegistrationTbl where Email='" + email + "' and Password='******'";
                DataTable dt1  = new DataTable();
                dt1 = dbm.ExecuteSelect(sql1);
                if (dt1.Rows.Count > 0)
                {
                    Session["PatientEmail"] = email;
                    Response.Redirect("Patient/Dashboard.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Password Invalid.')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('OTP Not Verified, You can not Login. Contact to Admin.')</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('Email Invalid.')</script>");
        }
    }
Beispiel #4
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataBaseManager dbm      = new DataBaseManager();
        string          email    = TextBox1.Text;
        string          password = TextBox2.Text;

        CryptoGraphy cg = new CryptoGraphy();

        password = cg.MD5Hash(password);
        string    sql1 = "select * from Admin where Email='" + email + "' and Password='******'";
        DataTable dt1  = new DataTable();

        dt1 = dbm.ExecuteSelect(sql1);
        if (dt1.Rows.Count > 0)
        {
            Session["AdminEmail"] = email;
            Response.Redirect("Admin/Dashboard.aspx");
        }
        else
        {
            Response.Write("<script>alert('Email ID or Password id Incorrect.')</script>");
        }
    }