2

This is a task I have to do for academia, is to develop a web site allowing the user to Sign up and login however without the use of a database as the backend. After a lot of thought and consideration I was perhaps going to tackle this problem by writing the sign up details to a text file in perhaps a comma delimited CSV file again when logging in read the detail from a CSV file. I was going to do this in JavaScript. After initial research it appears that most modern browsers won't allow the creation of a text file on the local machines hard disk for security reasons. Please note that the file storing the user details will be stored on the local hard disk.

Any help on the above problem much appreciated.

David Egan
  • 424
  • 2
  • 8
  • 23
  • I made a mock admin panel recently. I just have a `js` with user details and use timed-cookies to keep track of everyone. alert boxes work for my sign setup :) – Austin Aug 12 '14 at 14:25
  • Whats the question here? You gave the problem an the answer already. There s no best approach for the solution because have so much ways to do that. U can even do hardcoded the login and pass schema –  Aug 12 '14 at 14:26
  • You can't create files using javascript. – Kyle Emmanuel Aug 12 '14 at 14:27
  • mimic a user database using localstorage or other locally available datastore. – Kevin B Aug 12 '14 at 14:27
  • I would do that with PHP as backed and store user logins in text files. No matter the browser now, because its in backend. And also browser can use local storage. But I am not sure what kind of login it would be if not using server side. – Dariux Aug 12 '14 at 14:27
  • Please post what type of web server you use, that way you will get more useful answers – Adrian Aug 12 '14 at 14:32

2 Answers2

1

At a minimum you will need to maintain sessions on the server side; most web server will support this.

Starting point: Wikipedia: Session (computer science)

See also: SO: What are sessions? How do they work?

Community
  • 1
  • 1
Adrian
  • 6,013
  • 10
  • 47
  • 68
0

If I understand right, do you want to write a text file with javascript? :S. You can do that with PHP, for example, you can write in a file without database:

(Links without http:// beacause I don't have enought reputation :( ).

To open file: http://es1.php.net/manual/en/function.fopen.php

To read: http://es1.php.net/manual/en/function.fgets.php (read one file line)

To write: es1.php.net/manual/en/function.fwrite.php

A loop to read all the file: es1.php.net/manual/en/function.feof.php

while (!feof($file)) {
}

To close: es1.php.net/manual/en/function.fclose.php

mrroot5
  • 1,811
  • 3
  • 28
  • 33