J
jazz1010
Guest
I am using jquery ajax to insert data into txt file. Txt file contains three items UserName, Password and IsUsed. I am trying to return message if password exist for a specific username return message password already exist. If not Insert data into txt file. There are few scenario which I am trying to add
Sample Text File
UserName,Password,IsUsed
Sam,Sam123,1
Sam,Sam456,1
Sam,Sam879,0
Tom,Abc147,0
I am not how I can achieve this. Below is somewhat I think need to be used but not sure how to implement. Can anyone can help please?
string[] lines = File.ReadAllLines(path);
lines = lines.GroupBy(x => [username]).Where(g => g.Count() > 1).Select(g => g.Key).ToArray();
File.WriteAllLines(newPath, lines):
Jay P
Continue reading...
- When user enter username and Password. Check if the password is already used. In below sample table if user enters UserName: Sam and Password: Sam789. Program should insert new password. While inserting password mark previous password IsUsed as 1 and insert new row Sam,Sam789,0
- If same password entered again. Return message - "Password already used."
Sample Text File
UserName,Password,IsUsed
Sam,Sam123,1
Sam,Sam456,1
Sam,Sam879,0
Tom,Abc147,0
I am not how I can achieve this. Below is somewhat I think need to be used but not sure how to implement. Can anyone can help please?
string[] lines = File.ReadAllLines(path);
lines = lines.GroupBy(x => [username]).Where(g => g.Count() > 1).Select(g => g.Key).ToArray();
File.WriteAllLines(newPath, lines):
Jay P
Continue reading...