Beispiel #1
0
        private void btnExit_Click(object sender, EventArgs e)
        {
            CryptageEtHachage.HashXmlUsers(Variables.UserNom, Variables.UserPass, Application.StartupPath + "\\users.xml");


            Application.Exit();
        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            CryptageEtHachage.HashXmlUsers(Variables.UserNom, Variables.UserPass, Application.StartupPath + "\\users.xml");
            Variables.formLogin = new Page_entrée();
            Variables.formLogin.Show();

            this.Close();
            Variables.formLogin.ShowInTaskbar = true;
        }
Beispiel #3
0
        private void btnExit_Click(object sender, EventArgs e)
        {
            if (int.Parse(dr[0]["Perim"].ToString()) < score)
            {
                dr[0]["Perim"] = score; Variables.XmlWriter(Application.StartupPath + "\\users.xml");
            }
            CryptageEtHachage.HashXmlUsers(Variables.UserNom, Variables.UserPass, Application.StartupPath + "\\users.xml");

            Application.Exit();
        }
Beispiel #4
0
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            if ((int.Parse(dr[0]["Suitenb"].ToString()) > t) && (BeePic.Bounds.IntersectsWith(PicBeehive.Bounds)))
            {
                dr[0]["Suitenb"] = t;
                Variables.XmlWriter(Application.StartupPath + "\\users.xml");
            }
            Application.Exit();

            CryptageEtHachage.HashXmlUsers(Variables.UserNom, Variables.UserPass, Application.StartupPath + "\\users.xml");
        }
        private void btnconf_Click(object sender, EventArgs e)
        {
            //check for nom textbox if empty or not
            if (NomTxt.Text == "" || NomTxt.Text == "Votre nom")
            {
                wrongnom.Visible = true;
            }
            else
            {
                wrongnom.Visible = false;
            }

            //check for user textbox if empty or not

            if (usertxt.Text == "" || usertxt.Text == "Nom utilisateur")
            {
                wronguser.Visible = true;
            }
            else
            {
                wronguser.Visible = false;
            }

            //check for password textbox if empty or not

            if (PassTxt.Text == "" || PassTxt.Text == "Votre mot clé")
            {
                motclereg.Visible = true;
            }
            else
            {
                motclereg.Visible = false;
            }

            //check for password second time textbox if empty or not

            if (Confpass.Text == "" || Confpass.Text == "Confirmer Votre mot")
            {
                conf.Visible = true;
            }
            else
            {
                conf.Visible = false;
            }

            // check for type de l'utilisateur
            if ((radioBtnEleve.Checked == false) && (radioBtnProf.Checked == false))
            {
                typeq.Visible = true;
            }
            else
            {
                typeq.Visible = false;

                if (radioBtnEleve.Checked == true)
                {
                    Variables.Type = false;
                }
                else
                {
                    Variables.Type = true;
                }
            }

            //check for genre

            if ((male.Checked == false) && (femelle.Checked == false))
            {
                genreq.Visible = true;
            }
            else
            {
                genreq.Visible = false;
            }

            // il faut l'eleve de 5 ans et plus
            if (((2021 - Datepicker.Value.Year) < 5) && radioBtnEleve.Checked == true)
            {
                dateq.Visible = true;
            }

            else
            {
                if ((radioBtnEleve.Checked == false) || (radioBtnProf.Checked == false) || (male.Checked == false) || (femelle.Checked == false))
                {
                    dateq.Visible = false;

                    if ((usertxt.Text.Length > 0) && (PassTxt.Text.Length > 0) && (usertxt.Text != "Nom utilisateur") && (PassTxt.Text != "Votre mot clé"))
                    {
                        DataRow[] dr   = dt.Select("(([user] = '" + usertxt.Text + "') AND ([pass] = '" + PassTxt.Text + "'))");
                        DataRow[] deja = dt.Select("(([user] = '" + CryptageEtHachage.HashPasswordsAndScores(usertxt.Text) + "') AND ([nom] = '" + CryptageEtHachage.HashPasswordsAndScores(NomTxt.Text) + "'))");

                        if (deja.Length == 1)
                        {
                            utilisateurDeja.Visible = true;
                        }
                        else
                        {
                            utilisateurDeja.Visible = false;
                            dateq.Visible           = false;

                            DataRow dr2 = dt.NewRow();
                            dr2[0] = usertxt.Text;
                            dr2[1] = PassTxt.Text;
                            dr2[2] = NomTxt.Text;
                            dr2[3] = 2021 - Datepicker.Value.Year;

                            if (Variables.Type == false)
                            {
                                dr2[5] = "Eleve";
                            }
                            else
                            {
                                dr2[5] = "Prof";
                            }
                            if (male.Checked == true)
                            {
                                dr2[4] = "mâle";
                            }
                            else
                            {
                                dr2[4] = "femelle";
                            }

                            // set les scores = 0
                            for (int i = 6; i < 39; i++)
                            {
                                dr2[i] = 0;
                            }
                            dr2[23] = "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1";
                            dr2[38] = 60; //metre la meilleur score 60 s dans la jeux de suites de nbss

                            dt.Rows.Add(dr2);
                            ds.WriteXml(Application.StartupPath + "\\users.xml");
                            CryptageEtHachage.HashXmlUsers(usertxt.Text, PassTxt.Text, Application.StartupPath + "\\users.xml");
                            this.ShowInTaskbar = false;


                            Variables.intro = new Introduction();


                            intro_video intro_Video = new intro_video();
                            intro_Video.Show();



                            if ((dr2[4].ToString() == "mâle") && (Variables.Type = false))
                            {
                                Variables.B = new Bitmap(Application.StartupPath + "\\Pics\\boy.png");
                                Variables.intro.userphoto.Image = Variables.B;
                            }
                            else if ((dr2[4].ToString() == "femelle") && (Variables.Type = false))
                            {
                                Variables.B = new Bitmap(Application.StartupPath + "\\Pics\\girl.png");
                                Variables.intro.userphoto.Image = Variables.B;
                            }
                            else if ((dr2[4].ToString() == "mâle") && (Variables.Type = true))
                            {
                                Variables.B = new Bitmap(Application.StartupPath + "\\Pics\\administrator_male.png");
                                Variables.intro.userphoto.Image = Variables.B;
                            }
                            else if ((dr2[4].ToString() == "femelle") && (Variables.Type = true))
                            {
                                Variables.B = new Bitmap(Application.StartupPath + "\\Pics\\woman_profile.png");
                                Variables.intro.userphoto.Image = Variables.B;
                            }

                            Variables.exSup = dr2[23].ToString().Split(',');
                            Variables.intro.userphoto.Image = Variables.B;
                            Variables.UserNom             = usertxt.Text;
                            Variables.UserPass            = PassTxt.Text;
                            Variables.intro.username.Text = Variables.UserNom;
                            this.Hide();
                        }
                    }
                    else if ((usertxt.Text.Length > 0) && (((PassTxt.Text.Length == 0) || (PassTxt.Text == "Votre mot clé")) || ((Confpass.Text.Length == 0) || (Confpass.Text == "Confirmer Votre mot"))))
                    {
                        motclereg.Visible = true;
                        conf.Visible      = true;
                        if ((PassTxt.Text != Confpass.Text))
                        {
                            wrongpass.Visible = true;
                            conf.Visible      = false;
                        }
                        else
                        {
                            wrongpass.Visible = false;
                        }
                    }
                }
            }
        }