I created a C # registration form. This is the site and the buttons in it: Login and Register. It is necessary to register the user of the program on your computer. It is necessary that by clicking on the registration button, all the data that the user entered into the textboxes, recorded in some text file. And then in another form, if I type this data and press the input, so that it checks this data with a text file and if everything matches, it will reveal Success. Can I do this? Help with tips and tricks on how to do this, such as a small home database.
- @embarcadero I just want to sculpt myself. No, not necessarily C #, you can also in C ++, tell me how? - navi1893
- I can give the source, if of course you need. To edit and compile it, you need Qt Creator and Qt 4.8.1, well, or another version, you can even QtSdk. Pull? - embarcadero
- not. I do not think. Can you help with advice? - navi1893
- Do you suggest that he make a site on the cross? Well, you and I will tell you cruel! - johniek_comp
- 2I thought that he just wanted to have an app, not a word about the Asp site, no? - embarcadero
|
2 answers
Well, when registering, I would make such a code
using(StreamWriter sw = new StreamWriter(File.Create("data.txt"))) { sw.WriteLine(textBox1.Text); sw.WriteLine(textBox2.Text); sw.Close(); }
And at the entrance of such a code.
string username, password = string.Empty; using(StreamReader sr = new StreamReader(File.Open("data.txt", FileMode.Open))) { username = sr.ReadLine(); password = sr.ReadLine(); sr.Close(); if(username == textUserName.Text && password == textPassword.Text) { MessageBox("УСПЕШНО ВОШЛИ"); } else { MessageBox("Что-то тут не так"); } }
- oneand I would do this: ... sw.WriteLine (ComputeHash (textBox2.Text)); ... ... if (username == textUserName.Text && password == ComputeHash (textPassword.Text)) ... public string ComputeHash (string str) {var hashString = new System.Security.Cryptography.SHA1Managed (); Return hashString.ComputeHash (Encoding.Default.GetBytes (str)). Aggregate (string.Empty, (acc, el) => acc + String.Format ("{0: x2}", el)); } - Specter
- Thank! Just what you need! - navi1893
- @spectre @ angus123 advise me a book or website from where I can learn well C #, for a beginner. Thanks in advance - navi1893
- @ navil1893, write me your mail, I will take off my library)) - Angus123
- @ Angus123 Thank you so much!) O.alizade93@gmail.com - navi1893
|
C # and XML. Convenient way to store data. Part One , Part Two
For ASP, I think you modify it yourself, but in general, if there is a lot of data, it is better to use some kind of DBMS.
- thank! Read, if you have any questions, then ask) - navi1893
|