CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
How to make my files secure and use databases?



Jul 27, 2001, 8:35 AM

Post #1 of 2 (715 views)
How to make my files secure and use databases? Can't Post

How do I make my files that I am writing to secure, such as if I want to be able to have users goto a guest book and fill out information, and that information will then be written to a file, but in order for it to write it they have to have access to write to it, how do I make it so that the server does the writing for them so that people can't get into my website and modify the file with all of the information in it? I'm also interested in how to use databases.. Databases may be the solution to this for all I know, I am new so bare with me.. Thanks for any help, I appreciate it.


Jul 27, 2001, 9:15 AM

Post #2 of 2 (711 views)
Re: How to make my files secure and use databases? [In reply to] Can't Post

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 well as read from it.

If you had a form, such as a guestbook, the values could be saved to that guestbook. And each value can be appended after..

my $database;
$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


use CGI;
$a = new pointless CGI();


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives