Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using MySql.Data.MySqlClient;
- using System.Threading;
- namespace Rpg_Papier
- {
- public partial class Form9 : Form
- {
- public Form9()
- {
- InitializeComponent();
- TxtB_Password.PasswordChar = '*';
- this.Focus();
- ControlBox = false;
- }
- protected override void WndProc(ref Message m)
- {
- base.WndProc(ref m);
- }
- public int Compteur = 0;
- public static string NomPerso;
- public string LoginPerso;
- public static string AgePerso;
- public static string GenrePerso;
- public static string Arme = "sword";
- public static int degatArme = 10;
- public static string Artefact;
- public static int effetArtefact;
- public static string consumable;
- public static int effetconsumable;
- public static string NomBoss;
- public static int DegatTourJoueur;
- public static int DegatTourBoss;
- public static int PvJoueur = 100;
- public static int PvBoss = 100;
- public static int ChoixArme;
- public static int ChoixArtefact;
- public static int ChoixPotion;
- public static int PvFB = 1000;
- PremierNiveau f1 = new PremierNiveau();
- Creation f3 = new Creation();
- private void Form1_Load(object sender, EventArgs e)
- {
- this.Btn_Connection.FlatAppearance.BorderSize = 0;
- }
- private void Btn_Fermer_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
- private void Btn_Create_Click(object sender, EventArgs e)
- {
- Creation f3 = new Creation();
- f3.ShowDialog();
- }
- private void Lb_Titre_Click(object sender, EventArgs e)
- {
- //MessageBox.Show("i am a message");
- }
- private void Btn_Connection_Click(object sender, EventArgs e)
- {
- this.Focus();
- if (TxtB_Username.Text == "" && TxtB_Password.Text == "")
- {
- this.Focus();
- MessageBox.Show("Entrer un nom et un mot de passe " );
- this.Focus();
- }
- else if ( TxtB_Username.Text == "")
- {
- this.Focus();
- MessageBox.Show("Entrer un nom ");
- this.Focus();
- }
- else if (TxtB_Password.Text == "")
- {
- this.Focus();
- MessageBox.Show("Entrer un mot de passe ");
- this.Focus();
- }
- else
- {
- try
- {
- string MaConnexion = "data source=localhost;database=BD_RPGPAPIER;username=root;password=";
- MySqlConnection Ma_Connexion = new MySqlConnection(MaConnexion);
- MySqlCommand Ma_Commande = new MySqlCommand("select * from tbl_perso where PERSO_USER_NOM='" + this.TxtB_Username.Text + "' and PERSO_USER_PASSWORD='" + this.TxtB_Password.Text + "' ;", Ma_Connexion);
- MySqlDataReader Mon_Lecteur;
- Ma_Connexion.Open();
- Mon_Lecteur = Ma_Commande.ExecuteReader();
- while (Mon_Lecteur.Read())
- {
- Console.WriteLine(Mon_Lecteur[Compteur]);
- Compteur++;
- }
- if (Compteur == 1)
- {
- //MessageBox.Show("Nom d'utilisateur et mot de passe correct ");
- label1.Text = "Connexion Établi.";
- int i;
- for (i = 0; i < 1; i++)
- {
- Console.Write(i);
- Thread.Sleep(100);
- Compteur = 0;
- // TxtB_Username.Text = "";
- TxtB_Password.Text = "";
- LoginPerso = TxtB_Username.Text;
- string connexionF2 = "Data source=localhost;database=BD_RPGPAPIER;username=root;password=";
- string demande = "SELECT PERSO_NOM FROM tbl_perso WHERE `PERSO_USER_NOM`='" + LoginPerso + "';";
- MySqlConnection connexion2 = new MySqlConnection(connexionF2);
- MySqlCommand Commande2 = new MySqlCommand(demande, connexion2);
- MySqlDataReader myReader;
- connexion2.Open();
- myReader = Commande2.ExecuteReader();
- while (myReader.Read())
- {
- NomPerso = myReader.GetString("PERSO_NOM");
- }
- connexion2.Close();
- string connexionF3 = "Data source=localhost;database=BD_RPGPAPIER;username=root;password=";
- string demande3 = "SELECT PERSO_AGE FROM tbl_perso WHERE `PERSO_USER_NOM`='" + LoginPerso + "';";
- MySqlConnection connexion3 = new MySqlConnection(connexionF3);
- MySqlCommand Commande3 = new MySqlCommand(demande3, connexion3);
- MySqlDataReader myReader3;
- connexion3.Open();
- myReader3 = Commande3.ExecuteReader();
- while (myReader3.Read())
- {
- AgePerso = myReader3.GetString("PERSO_AGE");
- }
- connexion3.Close();
- string connexionF4 = "Data source=localhost;database=BD_RPGPAPIER;username=root;password=";
- string demande4 = "SELECT PERSO_SEXE FROM tbl_perso WHERE `PERSO_USER_NOM`='" + LoginPerso + "';";
- MySqlConnection connexion4 = new MySqlConnection(connexionF4);
- MySqlCommand Commande4 = new MySqlCommand(demande4, connexion4);
- MySqlDataReader myReader4;
- connexion4.Open();
- myReader4 = Commande4.ExecuteReader();
- while (myReader4.Read())
- {
- GenrePerso = myReader4.GetString("PERSO_SEXE");
- }
- connexion4.Close();
- this.Hide();
- CharacterScreen f2 = new CharacterScreen();
- f2.ShowDialog();
- this.Focus();
- }
- }
- else if (Compteur > 1)
- {
- // MessageBox.Show("Utilisateur et mot de passe Dupliqué");
- label1.Text = "Erreur de connexion vérifier \n les informations.";
- }
- else
- {
- // MessageBox.Show("Nom d'utilisateur et mot de passe incorrect \n Resssayer ");
- label1.Text = "Erreur de connexion vérifier \n les informations que vous avez entréer .";
- }
- Ma_Connexion.Close();
- this.Focus();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- this.Focus();
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- //f1.ShowDialog();
- }
- private void button1_Click_1(object sender, EventArgs e)
- {
- f1.ShowDialog();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement