private void Next_Click(object sender, EventArgs e) { if (mail.Text == mailconfirmation.Text) { if (session.checkLogin()) { Finish(); } Dictionary <string, string> user = session.getUserDetails(); string name = user[UserSessionManagement.KEY_NAME]; string password = user[UserSessionManagement.KEY_PASSWORD]; MySqlConnection con = new MySqlConnection("Server=cl1-sql22.phpnet.org;Port=3306;database=yzi38822; User Id=yzi38822;Password=M0kTZX33pyO6;"); con.Open(); editor.PutString(KEY_EMAIL, mail.Text); // string register = "UPDATE members SET mail = '" + mail.Text + "' where user = '******';"; //MySqlCommand cmd2 = new MySqlCommand(register, con); //cmd2.ExecuteNonQuery(); //StartActivity(typeof(ThirdRegister)); TextView1.Text = name; } else { TextView1.Text = "Nop"; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Profil); pseudo = FindViewById <EditText>(Resource.Id.pseudo); email = FindViewById <EditText>(Resource.Id.email); age = FindViewById <EditText>(Resource.Id.age); city = FindViewById <EditText>(Resource.Id.city); sport = FindViewById <EditText>(Resource.Id.sport); valider = FindViewById <Button>(Resource.Id.valider); accueil = FindViewById <Button>(Resource.Id.Accueil); valider.Click += Valider_Click; accueil.Click += Accueil_Click; session = new UserSessionManagement(Application.Context); if (session.checkLogin()) { Finish(); } Dictionary <string, string> user = session.getUserDetails(); string name = user[UserSessionManagement.KEY_NAME]; string password = user[UserSessionManagement.KEY_PASSWORD]; MySqlConnection con = new MySqlConnection("Server=cl1-sql22.phpnet.org;Port=3306;database=yzi38822; User Id=yzi38822;Password=M0kTZX33pyO6;"); if (con.State == ConnectionState.Closed) { con.Open(); } string query = "SELECT * FROM members WHERE user = '******'"; MySqlDataReader reader = new MySqlCommand(query, con).ExecuteReader(); if (reader.Read()) { pseudo.Text = (reader["user"].ToString()); email.Text = (reader["mail"].ToString()); // age.Text = (reader["birthday"].ToString()); sport.Text = (reader["sport"].ToString()); city.Text = (reader["city"].ToString()); reader.Close(); } else { sport.Text = "Erreur"; reader.Close(); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Home); session = new UserSessionManagement(Application.Context); button1 = FindViewById <Button>(Resource.Id.connect); textview1 = FindViewById <TextView>(Resource.Id.TextView1); textview2 = FindViewById <TextView>(Resource.Id.textView2); button1.Click += Button1_Click; if (session.checkLogin()) { Finish(); } Dictionary <string, string> user = session.getUserDetails(); string name = user[UserSessionManagement.KEY_NAME]; string email = user[UserSessionManagement.KEY_EMAIL]; MySqlConnection con = new MySqlConnection("Server=cl1-sql22.phpnet.org;Port=3306;database=yzi38822; User Id=yzi38822;Password=M0kTZX33pyO6;"); if (con.State == ConnectionState.Closed) { con.Open(); } string query = "SELECT user,password FROM members WHERE user = '******'"; MySqlDataReader reader = new MySqlCommand(query, con).ExecuteReader(); if (reader.Read()) { new AlertDialog.Builder(this) .SetMessage("Bienvenue " + (reader["user"].ToString())) .Show(); StartActivity(typeof(Profil)); } else { reader.Close(); } }
private void Enregister_Click(object sender, EventArgs e) { if (session.checkLogin()) { Finish(); } Dictionary <string, string> user = session.getUserDetails(); string name = user[UserSessionManagement.KEY_NAME]; string email = user[UserSessionManagement.KEY_EMAIL]; string password = user[UserSessionManagement.KEY_PASSWORD]; MySqlConnection con = new MySqlConnection("Server=cl1-sql22.phpnet.org;Port=3306;database=yzi38822; User Id=yzi38822;Password=M0kTZX33pyO6;"); con.Open(); string register = "INSERT INTO members (id,user,password,email,city) VALUES ('','" + user + "','" + password + "','" + email + "','" + ville.Text + "');";; MySqlCommand cmd2 = new MySqlCommand(register, con); cmd2.ExecuteNonQuery(); StartActivity(typeof(ThirdRegister)); }