コード例 #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        /*
         *
         * SqlCommand cmd = new SqlCommand("savedata",con);
         * cmd.CommandType = CommandType.StoredProcedure;
         * cmd.Parameters.AddWithValue("@un", TextBox1.Text);
         * cmd.Parameters.AddWithValue("@up", EncodePasswordToBase64(TextBox2.Text));
         * int a= cmd.ExecuteNonQuery();
         *
         * if(a!=0)
         * {
         *
         *  Response.Write("registered!!");
         * }
         * else
         * {
         *  Response.Write("not registered");
         * }
         */
        ns.Regis    obj    = new ns.Regis();
        ns.PrpRegis objprp = new ns.PrpRegis();
        objprp.uname = TextBox1.Text;
        objprp.upass = TextBox2.Text;
        int a = obj.savedata(objprp);

        if (a != 0)
        {
            Response.Write("registered!!");
        }
        else
        {
            Response.Write("not registered");
        }
    }
コード例 #2
0
        public int savedata(PrpRegis p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }

            SqlCommand cmd = new SqlCommand("savedata", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@un", p.uname);
            cmd.Parameters.AddWithValue("@up", EncodePasswordToBase64(p.upass));
            int a = cmd.ExecuteNonQuery();

            return(a);

            /* if (a != 0)
             * {
             *
             *   Response.Write("registered!!");
             * }
             * else
             * {
             *   Response.Write("not registered");
             * } */
        }
コード例 #3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        ns.Regis    obj    = new ns.Regis();
        ns.PrpRegis prpobj = new ns.PrpRegis();
        prpobj.uname = TextBox1.Text;
        string data = obj.checkusr(prpobj);

        if (TextBox2.Text == data)
        {
            Session["ss"] = prpobj.uname;
            Response.Redirect("content.aspx");
        }
        else
        {
            Response.Write("Wrongggggg");
        }
    }
コード例 #4
0
        public string checkusr(PrpRegis p)
        {
            string dpass = "******";

            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlCommand cmd = new SqlCommand("checkuser", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@un", p.uname);
            // cmd.Parameters.AddWithValue("@up", DecodeFrom64(TextBox2.Text));
            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                dpass = DecodeFrom64(dr[1].ToString());
            }
            return(dpass);
        }