Anonymous
Anonymous asked in Computers & InternetProgramming & Design · 7 years ago

where do i store login data on computer?

If i'm making a website where you signup what code do i use to store the username and password in a txt file.

Update:

forgot to mention this is a school project and my theacher wants it to show in a txt file

4 Answers

Relevance
  • 7 years ago
    Favorite Answer

    I agree with everything that Ramakrishnan says. Of course, this will not help you if you do not have a background in such techniques which really are intermediate to advanced. Do you have access to a database?

    Without knowing what type of code you are writing it would be difficult to give you alternatives. If for instance you are using a compiled server-side code like an ASP.NET web form, are using forms authentication and you only have a few passwords to store like your own admin password, then it would be work, BUT NOT BE GOOD to store this never-changing password hard coded inside the actual compiled code.

  • 7 years ago

    Storing your user's credential (username and password) in a text file is very dangerous as it has the highest risk, never do that, instead store it in a database and that too as a hashed value of the credentials. Thumb rule is never store the actual password anywhere in the system but only the irreversible hash value. There are lot of other ways to do that but this is the easiest and simple method. For hashing the value start with MD5 hashing, understand it and then move to other options.

  • ?
    Lv 7
    7 years ago

    You do NOT. NEVER store user names and passwords in text files it gives hackers easy access to your site and it can NOT control security. You become liable for any losses or disclosure of private data by your users. To allow user logins you need to use a database to store user details and control security and then use php to manipulate and read back the data to build pages according to the users and their requests.Even then you must NOT store passwords in clear text they must be encrypted or again a bad script or failure to validate data can give a hacker full access to the site including the site database user account. you must validate ALL use input to ensure they do not post scripts or links to scripts in any data field. Even a simple use of a data delimiter or very basic logic comparison operator in a user name or password box can give a hacker full access WITHOUT a password. In which case you will be lucky if your site lasts a week before it is running a background bank phishing site or child porn site and you would never know. Until the authorities come after YOU.

  • Chris
    Lv 7
    7 years ago

    I assume this if for PHP?

    Assuming the login credentials are sent using a POST form:

    $username = $_POST['username'];

    $password = $_POST['password'];

    $file = fopen("$username.txt", "w");

    fwrite($file, "$password");

    fclose($file);

    This will create a text file named after the user and containing the password.

Still have questions? Get your answers by asking now.