Jul 27, 2001, 9:15 AM
Post #2 of 2
There are several possible ways. Of course by CHMODing your database to 666, all programs can write to it. So you can have your guestbook script or any other script write to the database...as well as read from it.
Re: How to make my files secure and use databases?
[In reply to]
If you had a form, such as a guestbook, the values could be saved to that guestbook. And each value can be appended after..
$database = "/path/to/databasefile;
open (DATABASE, ">>$database");
flock (DATABSE, 2);
print DATABASE "all values you define to be saved\n";
flock (DATABSE, 8);
This is how I usually print the values of a form to a databse. This will allow you to save all the info that users submit to a form to a database file.
As for security: you can use .htaccess to set a password for the directory that you place the database in, but unless they guess the name of the database and the entire path, they could not read your database. But if you set .htaccess for the folder, then the user would be asked for a username and password to view the database.
I hope what I said was all correct. To my knowledge it is. If I am mistaken, someone will tell you what's right and what's wrong. There are plenty of places on here to learn how to write to databases and then read the database in another routine by a script. Look around and you can ask more questions. I hope this helpes somewhat. Good luck
$a = new pointless CGI();